@matheusbsbs / matheus-bagliano / commits / 3ac942d42e
Fork 0

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>

Jeff King committed Feb 20, 2011 at 04:51 UTC 3ac942d42ebb1fb48e70d3e5a714d06396e3e2c6
2 files changed +11
diff.h
+1
@@ -111,6 +111,7 @@ struct diff_options {
111 int rename_score;
112 int rename_limit;
113 int needed_rename_limit;
114 + int show_rename_progress;
115 int dirstat_percent;
116 int setup;
117 int abbrev;
diffcore-rename.c
+10
@@ -5,6 +5,7 @@
5 #include "diff.h"
6 #include "diffcore.h"
7 #include "hash.h"
8 +#include "progress.h"
9
10 /* Table of rename/copy destinations */
11
@@ -424,6 +425,7 @@ void diffcore_rename(struct diff_options *options)
425 struct diff_score *mx;
426 int i, j, rename_count;
427 int num_create, num_src, dst_cnt;
428 + struct progress *progress = NULL;
429
430 if (!minimum_score)
431 minimum_score = DEFAULT_RENAME_SCORE;
@@ -503,6 +505,12 @@ void diffcore_rename(struct diff_options *options)
505 goto cleanup;
506 }
507
508 + if (options->show_rename_progress) {
509 + progress = start_progress_delay(
510 + "Performing inexact rename detection",
511 + rename_dst_nr * rename_src_nr, 50, 1);
512 + }
513 +
514 mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx));
515 for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
516 struct diff_filespec *two = rename_dst[i].two;
@@ -532,7 +540,9 @@ void diffcore_rename(struct diff_options *options)
540 diff_free_filespec_blob(two);
541 }
542 dst_cnt++;
543 + display_progress(progress, (i+1)*rename_src_nr);
544 }
545 + stop_progress(&progress);
546
547 /* cost matrix sorted by most to least similar pair */
548 qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare);