summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-12-19 11:33:55 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-12-19 11:33:55 -0800
commit646685460c26d56b149da91544e76150119d9c9b (patch)
tree849f52fe2d1497e9bf6bb57ea4d06f3d0e190be9 /diffcore-rename.c
parentRelNotes: minor typo fixes in 2.16.0 draft (diff)
parentdiffcore-rename: make diff-tree -l0 mean -l<large> (diff)
downloadtgif-646685460c26d56b149da91544e76150119d9c9b.tar.xz
Merge branch 'en/rename-progress'
Historically, the diff machinery for rename detection had a hardcoded limit of 32k paths; this is being lifted to allow users trade cycles with a (possibly) easier to read result. * en/rename-progress: diffcore-rename: make diff-tree -l0 mean -l<large> sequencer: show rename progress during cherry picks diff: remove silent clamp of renameLimit progress: fix progress meters when dealing with lots of work sequencer: warn when internal merge may be suboptimal due to renameLimit
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 12dc2a056f..245e999fe5 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -391,14 +391,12 @@ static int too_many_rename_candidates(int num_create,
* growing larger than a "rename_limit" square matrix, ie:
*
* num_create * num_src > rename_limit * rename_limit
- *
- * but handles the potential overflow case specially (and we
- * assume at least 32-bit integers)
*/
- if (rename_limit <= 0 || rename_limit > 32767)
+ if (rename_limit <= 0)
rename_limit = 32767;
if ((num_create <= rename_limit || num_src <= rename_limit) &&
- (num_create * num_src <= rename_limit * rename_limit))
+ ((uint64_t)num_create * (uint64_t)num_src
+ <= (uint64_t)rename_limit * (uint64_t)rename_limit))
return 0;
options->needed_rename_limit =
@@ -415,7 +413,8 @@ static int too_many_rename_candidates(int num_create,
num_src++;
}
if ((num_create <= rename_limit || num_src <= rename_limit) &&
- (num_create * num_src <= rename_limit * rename_limit))
+ ((uint64_t)num_create * (uint64_t)num_src
+ <= (uint64_t)rename_limit * (uint64_t)rename_limit))
return 2;
return 1;
}
@@ -534,7 +533,7 @@ void diffcore_rename(struct diff_options *options)
if (options->show_rename_progress) {
progress = start_delayed_progress(
_("Performing inexact rename detection"),
- rename_dst_nr * rename_src_nr);
+ (uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
}
mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));
@@ -571,7 +570,7 @@ void diffcore_rename(struct diff_options *options)
diff_free_filespec_blob(two);
}
dst_cnt++;
- display_progress(progress, (i+1)*rename_src_nr);
+ display_progress(progress, (uint64_t)(i+1)*(uint64_t)rename_src_nr);
}
stop_progress(&progress);