Re: [PATCH 3/3] diff: make "too many files" rename warning optional
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> 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>
> ---
> This neglects the case where the user specifically does a diff asking
> for renames, but we turn it off. Maybe when "-M" is specified on the
> commandline to git-diff, we should set this option as well.
That sounds sensible. Like this?
diff --git a/diff.c b/diff.c
index f735519..e8a9286 100644
--- a/diff.c
+++ b/diff.c
@@ -2443,6 +2443,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
return -1;
options->detect_rename = DIFF_DETECT_RENAME;
+ options->warn_on_too_large_rename = 1;
}
else if (!prefixcmp(arg, "-C")) {
if (options->detect_rename == DIFF_DETECT_COPY)
@@ -2450,6 +2451,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
return -1;
options->detect_rename = DIFF_DETECT_COPY;
+ options->warn_on_too_large_rename = 1;
}
else if (!strcmp(arg, "--no-renames"))
options->detect_rename = 0;