aboutsummaryrefslogtreecommitdiff
path: root/diff-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-22 10:04:37 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-22 10:17:50 -0700
commit6b14d7faf0bad026a81a27bac07b47691f621b8f (patch)
treeb9d1923aaaea706179e9b27e07a843d277ad1bee /diff-helper.c
parent26dee0adfcfa6fc15a522d32765eabbe4f295237 (diff)
downloadgit-6b14d7faf0bad026a81a27bac07b47691f621b8f.tar.gz
git-6b14d7faf0bad026a81a27bac07b47691f621b8f.tar.xz
[PATCH] Diffcore updates.
This moves the path selection logic from individual programs to a new diffcore transformer (diff-tree still needs to have its own for performance reasons). Also the header printing code in diff-tree was tweaked not to produce anything when pickaxe is in effect and there is nothing interesting to report. An interesting example is the following in the GIT archive itself: $ git-whatchanged -p -C -S'or something in a real script' Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-helper.c')
-rw-r--r--diff-helper.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/diff-helper.c b/diff-helper.c
index d64d3baf9..0bc54a343 100644
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -77,11 +77,11 @@ int main(int ac, const char **av) {
else if (av[1][1] == 'P') /* hidden from the help */
diff_output_style = DIFF_FORMAT_MACHINE;
else if (av[1][1] == 'M') {
- detect_rename = 1;
+ detect_rename = DIFF_DETECT_RENAME;
diff_score_opt = diff_scoreopt_parse(av[1]);
}
else if (av[1][1] == 'C') {
- detect_rename = 2;
+ detect_rename = DIFF_DETECT_COPY;
diff_score_opt = diff_scoreopt_parse(av[1]);
}
else if (av[1][1] == 'S') {
@@ -93,7 +93,7 @@ int main(int ac, const char **av) {
}
/* the remaining parameters are paths patterns */
- diff_setup(reverse_diff, diff_output_style);
+ diff_setup(reverse_diff);
while (1) {
int status;
read_line(&sb1, stdin, line_termination);
@@ -121,14 +121,17 @@ int main(int ac, const char **av) {
status = parse_diff_raw(sb1.buf+1, NULL, NULL);
if (status) {
unrecognized:
- diff_flush(av+1, ac-1);
+ diff_flush(diff_output_style);
printf("%s%c", sb1.buf, line_termination);
}
}
if (detect_rename)
- diff_detect_rename(detect_rename, diff_score_opt);
+ diffcore_rename(detect_rename, diff_score_opt);
+ diffcore_prune();
if (pickaxe)
- diff_pickaxe(pickaxe);
- diff_flush(av+1, ac-1);
+ diffcore_pickaxe(pickaxe);
+ if (ac)
+ diffcore_pathspec(av + 1);
+ diff_flush(diff_output_style);
return 0;
}