diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-01-06 13:50:06 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-22 14:29:07 -0700 |
commit | f31027c99cb2ec4eb7ad8d1ebc7f0e20fef4bd1d (patch) | |
tree | ecc4d0213fcbd8c270b254cec1caff867034ac7d /builtin/diff-tree.c | |
parent | e88d6bc6f90059f6e87f6d51eba83ec15e4eecc9 (diff) | |
download | git-f31027c99cb2ec4eb7ad8d1ebc7f0e20fef4bd1d.tar.gz |
diffcore-rename: fall back to -C when -C -C busts the rename limit
When there are too many paths in the project, the number of rename source
candidates "git diff -C -C" finds will exceed the rename detection limit,
and no inexact rename detection is performed. We however could fall back
to "git diff -C" if the number of modified paths is sufficiently small.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/diff-tree.c')
-rw-r--r-- | builtin/diff-tree.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 0d2a3e9fa2..be6417d166 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -163,6 +163,9 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) } if (read_stdin) { + int saved_nrl = 0; + int saved_dcctc = 0; + if (opt->diffopt.detect_rename) opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE | DIFF_SETUP_USE_CACHE); @@ -173,9 +176,16 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) fputs(line, stdout); fflush(stdout); } - else + else { diff_tree_stdin(line); + if (saved_nrl < opt->diffopt.needed_rename_limit) + saved_nrl = opt->diffopt.needed_rename_limit; + if (opt->diffopt.degraded_cc_to_c) + saved_dcctc = 1; + } } + opt->diffopt.degraded_cc_to_c = saved_dcctc; + opt->diffopt.needed_rename_limit = saved_nrl; } return diff_result_code(&opt->diffopt, 0); |