summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-28 14:11:43 -0700
committerJunio C Hamano <gitster@pobox.com>2011-04-28 14:11:43 -0700
commit76a89d6d828486f96f42c69ef0cf87bb6b72fef5 (patch)
treee5112817beba1e701d20e88b4d0c5bdf5fe7de0d /diff.c
parent78c6e0f3fa41d697f2e01850b0a361e21095545d (diff)
parentf31027c99cb2ec4eb7ad8d1ebc7f0e20fef4bd1d (diff)
downloadgit-76a89d6d828486f96f42c69ef0cf87bb6b72fef5.tar.gz
Merge branch 'jc/rename-degrade-cc-to-c'
* jc/rename-degrade-cc-to-c: diffcore-rename: fall back to -C when -C -C busts the rename limit diffcore-rename: record filepair for rename src diffcore-rename: refactor "too many candidates" logic builtin/diff.c: remove duplicated call to diff_result_code()
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 5376d01e1b..56758c7dca 100644
--- a/diff.c
+++ b/diff.c
@@ -3987,6 +3987,28 @@ static int is_summary_empty(const struct diff_queue_struct *q)
return 1;
}
+static const char rename_limit_warning[] =
+"inexact rename detection was skipped due to too many files.";
+
+static const char degrade_cc_to_c_warning[] =
+"only found copies from modified paths due to too many files.";
+
+static const char rename_limit_advice[] =
+"you may want to set your %s variable to at least "
+"%d and retry the command.";
+
+void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc)
+{
+ if (degraded_cc)
+ warning(degrade_cc_to_c_warning);
+ else if (needed)
+ warning(rename_limit_warning);
+ else
+ return;
+ if (0 < needed && needed < 32767)
+ warning(rename_limit_advice, varname, needed);
+}
+
void diff_flush(struct diff_options *options)
{
struct diff_queue_struct *q = &diff_queued_diff;
@@ -4268,6 +4290,10 @@ void diffcore_std(struct diff_options *options)
int diff_result_code(struct diff_options *opt, int status)
{
int result = 0;
+
+ diff_warn_rename_limit("diff.renamelimit",
+ opt->needed_rename_limit,
+ opt->degraded_cc_to_c);
if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
!(opt->output_format & DIFF_FORMAT_CHECKDIFF))
return status;