summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorEdmundo Carmona Antoranz <eantoranz@gmail.com>2022-04-06 18:13:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-04-06 20:29:59 (GMT)
commite5f5d7d42effb1d0d404897ac782783f742e9daa (patch)
treef6c7fe3f53ac77de4a59ff5872c5cca5e7bd3a3e /builtin/blame.c
parent4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a (diff)
downloadgit-e5f5d7d42effb1d0d404897ac782783f742e9daa.zip
git-e5f5d7d42effb1d0d404897ac782783f742e9daa.tar.gz
git-e5f5d7d42effb1d0d404897ac782783f742e9daa.tar.bz2
blame: report correct number of lines in progress when using ranges
When using ranges, use the range sizes as the limit for progress instead of the size of the full file. Before: $ git blame --progress builtin/blame.c > /dev/null Blaming lines: 100% (1210/1210), done. $ git blame --progress -L 100,120 -L 200,300 builtin/blame.c > /dev/null Blaming lines: 10% (122/1210), done. $ After: $ ./git blame --progress builtin/blame.c > /dev/null Blaming lines: 100% (1210/1210), done. $ ./git blame --progress -L 100,120 -L 200,300 builtin/blame.c > /dev/null Blaming lines: 100% (122/122), done. $ Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 7fafeac..832478e 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -897,6 +897,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);
@@ -1127,7 +1128,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);
@@ -1156,7 +1160,7 @@ parse_done:
sb.found_guilty_entry = &found_guilty_entry;
sb.found_guilty_entry_data = &pi;
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);