aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-21 00:18:27 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-24 23:50:44 -0700
commit8082d8d3050e3fdd7b0f13c7a7b3ad68af7f478a (patch)
tree6939780586028325f91f5193c56ba42eafef179c /diff.c
parent6b5ee137e56af8093391411389dd4b18416707ec (diff)
downloadgit-8082d8d3050e3fdd7b0f13c7a7b3ad68af7f478a.tar.gz
git-8082d8d3050e3fdd7b0f13c7a7b3ad68af7f478a.tar.xz
Diff: -l<num> to limit rename/copy detection.
When many paths are modified, rename detection takes a lot of time. The new option -l<num> can be used to disable rename detection when more than <num> paths are possibly created as renames. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 77d316671..cafc75540 100644
--- a/diff.c
+++ b/diff.c
@@ -674,11 +674,12 @@ void diff_setup(struct diff_options *options)
options->output_format = DIFF_FORMAT_RAW;
options->line_termination = '\n';
options->break_opt = -1;
+ options->rename_limit = -1;
}
int diff_setup_done(struct diff_options *options)
{
- if (options->find_copies_harder &&
+ if ((options->find_copies_harder || 0 <= options->rename_limit) &&
options->detect_rename != DIFF_DETECT_COPY)
return -1;
if (options->setup & DIFF_SETUP_USE_CACHE) {
@@ -704,6 +705,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->output_format = DIFF_FORMAT_PATCH;
else if (!strcmp(arg, "-z"))
options->line_termination = 0;
+ else if (!strncmp(arg, "-l", 2))
+ options->rename_limit = strtoul(arg+2, NULL, 10);
else if (!strcmp(arg, "--name-only"))
options->output_format = DIFF_FORMAT_NAME;
else if (!strcmp(arg, "-R"))
@@ -1141,7 +1144,7 @@ void diffcore_std(struct diff_options *options)
if (options->break_opt != -1)
diffcore_break(options->break_opt);
if (options->detect_rename)
- diffcore_rename(options->detect_rename, options->rename_score);
+ diffcore_rename(options);
if (options->break_opt != -1)
diffcore_merge_broken();
if (options->pickaxe)