aboutsummaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-02-20 04:51:16 -0500
committerJunio C Hamano <gitster@pobox.com>2011-02-21 10:24:07 -0800
commit3ac942d42ebb1fb48e70d3e5a714d06396e3e2c6 (patch)
tree59dd09d58ee61f812011e4c51ed5800656368800 /diffcore-rename.c
parent485445e22ab30e40a94ef5b59e46616912d01720 (diff)
downloadgit-3ac942d42ebb1fb48e70d3e5a714d06396e3e2c6.tar.gz
git-3ac942d42ebb1fb48e70d3e5a714d06396e3e2c6.tar.xz
add inexact rename detection progress infrastructure
We might spend many seconds doing inexact rename detection with no output. It's nice to let the user know that something is actually happening. This patch adds the infrastructure, but no callers actually turn on progress reporting. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 1943c46b9..cb57f5127 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -5,6 +5,7 @@
#include "diff.h"
#include "diffcore.h"
#include "hash.h"
+#include "progress.h"
/* Table of rename/copy destinations */
@@ -424,6 +425,7 @@ void diffcore_rename(struct diff_options *options)
struct diff_score *mx;
int i, j, rename_count;
int num_create, num_src, dst_cnt;
+ struct progress *progress = NULL;
if (!minimum_score)
minimum_score = DEFAULT_RENAME_SCORE;
@@ -503,6 +505,12 @@ void diffcore_rename(struct diff_options *options)
goto cleanup;
}
+ if (options->show_rename_progress) {
+ progress = start_progress_delay(
+ "Performing inexact rename detection",
+ rename_dst_nr * rename_src_nr, 50, 1);
+ }
+
mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx));
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
struct diff_filespec *two = rename_dst[i].two;
@@ -532,7 +540,9 @@ void diffcore_rename(struct diff_options *options)
diff_free_filespec_blob(two);
}
dst_cnt++;
+ display_progress(progress, (i+1)*rename_src_nr);
}
+ stop_progress(&progress);
/* cost matrix sorted by most to least similar pair */
qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare);