diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-05-11 03:41:11 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-11 03:41:11 +0300 |
commit | bcccafbef046c9072ef45993c4b7a7926ae2cf88 (patch) | |
tree | b890a8304d87d66c1e53444dc77b46c25ea68eaa /builtin/blame.c | |
parent | 123dfdff0d6e886ce5536d39dd77dcd46db8d4c0 (diff) | |
parent | e5f5d7d42effb1d0d404897ac782783f742e9daa (diff) |
Merge branch 'ea/progress-partial-blame'
The progress meter of "git blame" was showing incorrect numbers
when processing only parts of the file.
* ea/progress-partial-blame:
blame: report correct number of lines in progress when using ranges
Diffstat (limited to 'builtin/blame.c')
-rw-r--r-- | builtin/blame.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 8d15b68afc..e33372c56b 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -898,6 +898,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) unsigned int range_i; long anchor; const int hexsz = the_hash_algo->hexsz; + long num_lines = 0; setup_default_color_by_age(); git_config(git_blame_config, &output_option); @@ -1129,7 +1130,10 @@ parse_done: for (range_i = ranges.nr; range_i > 0; --range_i) { const struct range *r = &ranges.ranges[range_i - 1]; ent = blame_entry_prepend(ent, r->start, r->end, o); + num_lines += (r->end - r->start); } + if (!num_lines) + num_lines = sb.num_lines; o->suspects = ent; prio_queue_put(&sb.commits, o->commit); @@ -1158,7 +1162,7 @@ parse_done: sb.found_guilty_entry = &found_guilty_entry; sb.found_guilty_entry_data = π if (show_progress) - pi.progress = start_delayed_progress(_("Blaming lines"), sb.num_lines); + pi.progress = start_delayed_progress(_("Blaming lines"), num_lines); assign_blame(&sb, opt); |