diff: make "too many files" rename warning optional
In many cases, the warning ends up as clutter, because the diff is being done "behind the scenes" from the user (e.g., when generating a commit diffstat), and whether we show renames or not is not particularly interesting to the user. However, in the case of a merge (which is what motivated the warning in the first place), it is a useful hint as to why a merge with renames might have failed. This patch makes the warning optional based on the code calling into diffcore. We default to not showing the warning, but turn it on for merges. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 30, 2008 at 13:25 UTC
b8960bbe7bdfc0b232462f916ee8151c83afd16f
3 files changed
+4
-1
builtin-merge-recursive.c
+1
@@ -365,6 +365,7 @@ static struct path_list *get_renames(struct tree *tree,
365
opts.rename_limit = merge_rename_limit >= 0 ? merge_rename_limit :
366
diff_rename_limit >= 0 ? diff_rename_limit :
367
500;
368
+ opts.warn_on_too_large_rename = 1;
369
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
370
if (diff_setup_done(&opts) < 0)
371
die("diff setup failed");
diff.h
+1
@@ -83,6 +83,7 @@ struct diff_options {
83
int pickaxe_opts;
84
int rename_score;
85
int rename_limit;
86
+ int warn_on_too_large_rename;
87
int dirstat_percent;
88
int setup;
89
int abbrev;
diffcore-rename.c
+2
-1
@@ -492,7 +492,8 @@ void diffcore_rename(struct diff_options *options)
492
rename_limit = 32767;
493
if ((num_create > rename_limit && num_src > rename_limit) ||
494
(num_create * num_src > rename_limit * rename_limit)) {
495
- warning("too many files, skipping inexact rename detection");
495
+ if (options->warn_on_too_large_rename)
496
+ warning("too many files, skipping inexact rename detection");
497
goto cleanup;
498
}
499