Skip to content

Commit 81c4bf0

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ad8a1be commit 81c4bf0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

diffcore-rename.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void diffcore_rename(struct diff_options *options)
593593
if (options->show_rename_progress) {
594594
progress = start_delayed_progress(
595595
_("Performing inexact rename detection"),
596-
(uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
596+
(uint64_t)num_destinations * (uint64_t)rename_src_nr);
597597
}
598598

599599
mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_destinations),
@@ -633,7 +633,8 @@ void diffcore_rename(struct diff_options *options)
633633
diff_free_filespec_blob(two);
634634
}
635635
dst_cnt++;
636-
display_progress(progress, (uint64_t)(i+1)*(uint64_t)rename_src_nr);
636+
display_progress(progress,
637+
(uint64_t)dst_cnt * (uint64_t)rename_src_nr);
637638
}
638639
stop_progress(&progress);
639640

0 commit comments

Comments
 (0)