diff options
author | Junio C Hamano <junkio@cox.net> | 2005-05-21 19:40:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-21 22:49:19 -0700 |
commit | 38c6f78059c3060db6f94b24f4a90063a91090d2 (patch) | |
tree | 18d06f832da6e27f4b600b64b3dc27c393c71ea1 /diff-tree.c | |
parent | 58b103f55d5b95dc24cce2fb4f64e697958fd204 (diff) | |
download | git-38c6f78059c3060db6f94b24f4a90063a91090d2.tar.gz |
[PATCH] Prepare diffcore interface for diff-tree header supression.
This does not actually supress the extra headers when pickaxe is
used, but prepares enough support for diff-tree to implement it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-tree.c')
-rw-r--r-- | diff-tree.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/diff-tree.c b/diff-tree.c index 68186484b1..e8bad72214 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -267,16 +267,28 @@ static int diff_tree_sha1(const unsigned char *old, const unsigned char *new, co return retval; } +static void call_diff_setup(void) +{ + diff_setup(reverse_diff, (generate_patch ? -1 : line_termination)); +} + +static void call_diff_flush(void) +{ + if (detect_rename) + diff_detect_rename(detect_rename, diff_score_opt); + if (pickaxe) + diff_pickaxe(pickaxe); + diff_flush(NULL, 0); +} + static int diff_tree_sha1_top(const unsigned char *old, const unsigned char *new, const char *base) { int ret; - diff_setup(detect_rename, diff_score_opt, pickaxe, - reverse_diff, (generate_patch ? -1 : line_termination), - NULL, 0); + call_diff_setup(); ret = diff_tree_sha1(old, new, base); - diff_flush(); + call_diff_flush(); return ret; } @@ -286,15 +298,13 @@ static int diff_root_tree(const unsigned char *new, const char *base) void *tree; unsigned long size; - diff_setup(detect_rename, diff_score_opt, pickaxe, - reverse_diff, (generate_patch ? -1 : line_termination), - NULL, 0); + call_diff_setup(); tree = read_object_with_reference(new, "tree", &size, NULL); if (!tree) die("unable to read root tree (%s)", sha1_to_hex(new)); retval = diff_tree("", 0, tree, size, base); free(tree); - diff_flush(); + call_diff_flush(); return retval; } |