mirror of
https://github.com/git/git.git
synced 2024-12-18 06:14:59 +08:00
12da1d1f6f
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>
44 lines
795 B
Plaintext
44 lines
795 B
Plaintext
commit 4a23ae5c98d59a58c6da036156959f2dc9f472ad
|
|
Author: Thomas Rast <trast@student.ethz.ch>
|
|
Date: Thu Feb 28 10:47:40 2013 +0100
|
|
|
|
change at very beginning
|
|
|
|
diff --git a/a.c b/a.c
|
|
--- a/a.c
|
|
+++ b/a.c
|
|
@@ -1,3 +1,4 @@
|
|
+#include <unistd.h>
|
|
#include <stdio.h>
|
|
|
|
long f(long x)
|
|
|
|
commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2
|
|
Author: Thomas Rast <trast@student.ethz.ch>
|
|
Date: Thu Feb 28 10:45:16 2013 +0100
|
|
|
|
touch both functions
|
|
|
|
diff --git a/a.c b/a.c
|
|
--- a/a.c
|
|
+++ b/a.c
|
|
@@ -1,3 +1,3 @@
|
|
#include <stdio.h>
|
|
|
|
-int f(int x)
|
|
+long f(long x)
|
|
|
|
commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a
|
|
Author: Thomas Rast <trast@student.ethz.ch>
|
|
Date: Thu Feb 28 10:44:48 2013 +0100
|
|
|
|
initial
|
|
|
|
diff --git a/a.c b/a.c
|
|
--- /dev/null
|
|
+++ b/a.c
|
|
@@ -0,0 +1,3 @@
|
|
+#include <stdio.h>
|
|
+
|
|
+int f(int x)
|