Code

diff: make "too many files" rename warning optional
authorJeff King <peff@peff.net>
Wed, 30 Apr 2008 17:25:53 +0000 (13:25 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 3 May 2008 20:40:43 +0000 (13:40 -0700)
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>
builtin-merge-recursive.c
diff.h
diffcore-rename.c

index 3902e910694e00dead5154ad8dfe8c1f231e20a2..46e636fdcf1cb854a486e425df05a2485d18d5d7 100644 (file)
@@ -365,6 +365,7 @@ static struct path_list *get_renames(struct tree *tree,
        opts.rename_limit = merge_rename_limit >= 0 ? merge_rename_limit :
                            diff_rename_limit >= 0 ? diff_rename_limit :
                            500;
+       opts.warn_on_too_large_rename = 1;
        opts.output_format = DIFF_FORMAT_NO_OUTPUT;
        if (diff_setup_done(&opts) < 0)
                die("diff setup failed");
diff --git a/diff.h b/diff.h
index f2c77391a965bcc731de6478a6553cdc652319ec..893111606826d600dacc6789cea319ce088e14c6 100644 (file)
--- a/diff.h
+++ b/diff.h
@@ -83,6 +83,7 @@ struct diff_options {
        int pickaxe_opts;
        int rename_score;
        int rename_limit;
+       int warn_on_too_large_rename;
        int dirstat_percent;
        int setup;
        int abbrev;
index 1369a5ec45349c1ef04e4df2d7d7d4dd28cd3596..1b2ebb40014d820fe4fb679509ab694d453be7b4 100644 (file)
@@ -492,7 +492,8 @@ void diffcore_rename(struct diff_options *options)
                rename_limit = 32767;
        if ((num_create > rename_limit && num_src > rename_limit) ||
            (num_create * num_src > rename_limit * rename_limit)) {
-               warning("too many files, skipping inexact rename detection");
+               if (options->warn_on_too_large_rename)
+                       warning("too many files, skipping inexact rename detection");
                goto cleanup;
        }