|
5 | 5 | #include "diff.h" |
6 | 6 | #include "diffcore.h" |
7 | 7 | #include "hash.h" |
| 8 | +#include "progress.h" |
8 | 9 |
|
9 | 10 | /* Table of rename/copy destinations */ |
10 | 11 |
|
@@ -449,6 +450,7 @@ void diffcore_rename(struct diff_options *options) |
449 | 450 | struct diff_score *mx; |
450 | 451 | int i, j, rename_count; |
451 | 452 | int num_create, num_src, dst_cnt; |
| 453 | + struct progress *progress = NULL; |
452 | 454 |
|
453 | 455 | if (!minimum_score) |
454 | 456 | minimum_score = DEFAULT_RENAME_SCORE; |
@@ -518,15 +520,22 @@ void diffcore_rename(struct diff_options *options) |
518 | 520 | * but handles the potential overflow case specially (and we |
519 | 521 | * assume at least 32-bit integers) |
520 | 522 | */ |
| 523 | + options->needed_rename_limit = 0; |
521 | 524 | if (rename_limit <= 0 || rename_limit > 32767) |
522 | 525 | rename_limit = 32767; |
523 | 526 | if ((num_create > rename_limit && num_src > rename_limit) || |
524 | 527 | (num_create * num_src > rename_limit * rename_limit)) { |
525 | | - if (options->warn_on_too_large_rename) |
526 | | - warning("too many files (created: %d deleted: %d), skipping inexact rename detection", num_create, num_src); |
| 528 | + options->needed_rename_limit = |
| 529 | + num_src > num_create ? num_src : num_create; |
527 | 530 | goto cleanup; |
528 | 531 | } |
529 | 532 |
|
| 533 | + if (options->show_rename_progress) { |
| 534 | + progress = start_progress_delay( |
| 535 | + "Performing inexact rename detection", |
| 536 | + rename_dst_nr * rename_src_nr, 50, 1); |
| 537 | + } |
| 538 | + |
530 | 539 | mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx)); |
531 | 540 | for (dst_cnt = i = 0; i < rename_dst_nr; i++) { |
532 | 541 | struct diff_filespec *two = rename_dst[i].two; |
@@ -556,7 +565,9 @@ void diffcore_rename(struct diff_options *options) |
556 | 565 | diff_free_filespec_blob(two); |
557 | 566 | } |
558 | 567 | dst_cnt++; |
| 568 | + display_progress(progress, (i+1)*rename_src_nr); |
559 | 569 | } |
| 570 | + stop_progress(&progress); |
560 | 571 |
|
561 | 572 | /* cost matrix sorted by most to least similar pair */ |
562 | 573 | qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare); |
|
0 commit comments