summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-12-11 09:08:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-14 17:34:50 (GMT)
commit81c4bf02964e51d0cde79304794d51da86d23b09 (patch)
tree188d617e01525d95fd13a84659cd120944b88079 /diffcore-rename.c
parentad8a1be529ea9e0bd6346a3cb1d53fec16e3bd10 (diff)
downloadgit-81c4bf02964e51d0cde79304794d51da86d23b09.zip
git-81c4bf02964e51d0cde79304794d51da86d23b09.tar.gz
git-81c4bf02964e51d0cde79304794d51da86d23b09.tar.bz2
diffcore-rename: reduce jumpiness in progress counters
Inexact rename detection works by comparing all sources to all destinations, computing similarities, and then finding the best matches among those that are sufficiently similar. However, it is preceded by exact rename detection that works by checking if there are files with identical hashes. If exact renames are found, we can exclude some files from inexact rename detection. The inexact rename detection loops over the full set of files, but immediately skips those for which rename_dst[i].is_rename is true and thus doesn't compare any sources to that destination. As such, these paths shouldn't be included in the progress counter. For the eagle eyed, this change hints at an actual optimization -- the first one I presented at Git Merge 2020. I'll be submitting that optimization later, once the basic merge-ort algorithm has merged. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 16553ab..55a188a 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -593,7 +593,7 @@ void diffcore_rename(struct diff_options *options)
if (options->show_rename_progress) {
progress = start_delayed_progress(
_("Performing inexact rename detection"),
- (uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
+ (uint64_t)num_destinations * (uint64_t)rename_src_nr);
}
mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_destinations),
@@ -633,7 +633,8 @@ void diffcore_rename(struct diff_options *options)
diff_free_filespec_blob(two);
}
dst_cnt++;
- display_progress(progress, (uint64_t)(i+1)*(uint64_t)rename_src_nr);
+ display_progress(progress,
+ (uint64_t)dst_cnt * (uint64_t)rename_src_nr);
}
stop_progress(&progress);