diff options
author | Thomas Rast <trast@student.ethz.ch> | 2013-03-28 17:47:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-28 10:29:22 -0700 |
commit | 12da1d1f6ffcd546a892a33302bb34fd37169022 (patch) | |
tree | a70c5244b7b27d77c9c58d48a4e88215a956d731 /Documentation/git-log.txt | |
parent | Export rewrite_parents() for 'log -L' (diff) | |
download | tgif-12da1d1f6ffcd546a892a33302bb34fd37169022.tar.xz |
Implement line-history search (git log -L)
This is a rewrite of much of Bo's work, mainly in an effort to split
it into smaller, easier to understand routines.
The algorithm is built around the struct range_set, which encodes a
series of line ranges as intervals [a,b). This is used in two
contexts:
* A set of lines we are tracking (which will change as we dig through
history).
* To encode diffs, as pairs of ranges.
The main routine is range_set_map_across_diff(). It processes the
diff between a commit C and some parent P. It determines which diff
hunks are relevant to the ranges tracked in C, and computes the new
ranges for P.
The algorithm is then simply to process history in topological order
from newest to oldest, computing ranges and (partial) diffs. At
branch points, we need to merge the ranges we are watching. We will
find that many commits do not affect the chosen ranges, and mark them
TREESAME (in addition to those already filtered by pathspec limiting).
Another pass of history simplification then gets rid of such commits.
This is wired as an extra filtering pass in the log machinery. This
currently only reduces code duplication, but should allow for other
simplifications and options to be used.
Finally, we hook a diff printer into the output chain. Ideally we
would wire directly into the diff logic, to optionally use features
like word diff. However, that will require some major reworking of
the diff chain, so we completely replace the output with our own diff
for now.
As this was a GSoC project, and has quite some history by now, many
people have helped. In no particular order, thanks go to
Jakub Narebski <jnareb@gmail.com>
Jens Lehmann <Jens.Lehmann@web.de>
Jonathan Nieder <jrnieder@gmail.com>
Junio C Hamano <gitster@pobox.com>
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Will Palmer <wmpalmer@gmail.com>
Apologies to everyone I forgot.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-log.txt')
-rw-r--r-- | Documentation/git-log.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 69db5783ce..8727c60ab3 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -69,6 +69,23 @@ produced by --stat etc. Note that only message is considered, if also a diff is shown its size is not included. +-L <start>,<end>:<file>:: + Trace the evolution of the line range given by "<start>,<end>" + within the <file>. You may not give any pathspec limiters. + This is currently limited to a walk starting from a single + revision, i.e., you may only give zero or one positive + revision arguments. + +<start> and <end> can take one of these forms: + +include::line-range-format.txt[] +You can specify this option more than once. + + +--full-line-diff:: + Always print the interesting range even if the current commit + does not change any line of the range. + [\--] <path>...:: Show only commits that are enough to explain how the files that match the specified paths came to be. See "History @@ -138,6 +155,11 @@ Examples This makes sense only when following a strict policy of merging all topic branches when staying on a single integration branch. +git log -L '/int main/',/^}/:main.c:: + + Shows how the function `main()` in the file 'main.c' evolved + over time. + `git log -3`:: Limits the number of commits to show to 3. |