Please sign in to comment.
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 <firstname.lastname@example.org> Jens Lehmann <Jens.Lehmann@web.de> Jonathan Nieder <email@example.com> Junio C Hamano <firstname.lastname@example.org> Ramsay Jones <email@example.com> Will Palmer <firstname.lastname@example.org> Apologies to everyone I forgot. Signed-off-by: Bo Yang <email@example.com> Signed-off-by: Thomas Rast <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
- Loading branch information...
Showing with 2,156 additions and 2 deletions.
- +22 −0 Documentation/git-log.txt
- +2 −0 Makefile
- +31 −0 builtin/log.c
- +1,179 −0 line-log.c
- +49 −0 line-log.h
- +18 −1 line-range.c
- +11 −0 line-range.h
- +4 −0 log-tree.c
- +9 −0 revision.c
- +5 −1 revision.h
- +34 −0 t/perf/p4211-line-log.sh
- +49 −0 t/t4211-line-log.sh
- +43 −0 t/t4211/expect.beginning-of-file
- +62 −0 t/t4211/expect.end-of-file
- +40 −0 t/t4211/expect.move-support-f
- +59 −0 t/t4211/expect.simple-f
- +68 −0 t/t4211/expect.simple-main
- +102 −0 t/t4211/expect.two-ranges
- +39 −0 t/t4211/expect.vanishes-early
- +330 −0 t/t4211/history.export
Oops, something went wrong.