Skip to content

Commit 34a9b32

Browse files
committed
Merge branch 'ea/progress-partial-blame' into jch
source: <20220403165038.52803-1-eantoranz@gmail.com> * ea/progress-partial-blame: blame: report correct number of lines in progress when using ranges
2 parents fb68242 + 995da68 commit 34a9b32

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

builtin/blame.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
898898
unsigned int range_i;
899899
long anchor;
900900
const int hexsz = the_hash_algo->hexsz;
901+
long num_lines = 0;
901902

902903
setup_default_color_by_age();
903904
git_config(git_blame_config, &output_option);
@@ -1129,7 +1130,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
11291130
for (range_i = ranges.nr; range_i > 0; --range_i) {
11301131
const struct range *r = &ranges.ranges[range_i - 1];
11311132
ent = blame_entry_prepend(ent, r->start, r->end, o);
1133+
num_lines += (r->end - r->start);
11321134
}
1135+
if (!num_lines)
1136+
num_lines = sb.num_lines;
11331137

11341138
o->suspects = ent;
11351139
prio_queue_put(&sb.commits, o->commit);
@@ -1158,7 +1162,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
11581162
sb.found_guilty_entry = &found_guilty_entry;
11591163
sb.found_guilty_entry_data = &pi;
11601164
if (show_progress)
1161-
pi.progress = start_delayed_progress(_("Blaming lines"), sb.num_lines);
1165+
pi.progress = start_delayed_progress(_("Blaming lines"), num_lines);
11621166

11631167
assign_blame(&sb, opt);
11641168

0 commit comments

Comments
 (0)