Skip to content

Commit

Permalink
commit-graph: increment progress indicator
Browse files Browse the repository at this point in the history
This fixes a bug that was introduced by 368d19b (commit-graph:
refactor compute_topological_levels(), 2023-03-20): Previously, the
progress indicator was updated from `i + 1` where `i` is the loop
variable of the enclosing `for` loop. After this patch, the update used
`info->progress_cnt + 1` instead, however, unlike `i`, the
`progress_cnt` attribute was not incremented. Let's increment it.

To prevent this from regressing again, extend the existing test case
t6500.11 'with TTY: gc --no-quiet' to verify that the progress meter
reaches 100% (without this fix, it would have reached only 25%).

Helped-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
derrickstolee authored and dscho committed Jun 12, 2024
1 parent 7b0defb commit 3fa7b62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ static void compute_reachable_generation_numbers(
timestamp_t gen;
repo_parse_commit(info->r, c);
gen = info->get_generation(c, info->data);
display_progress(info->progress, info->progress_cnt + 1);
display_progress(info->progress, ++info->progress_cnt);

if (gen != GENERATION_NUMBER_ZERO && gen != GENERATION_NUMBER_INFINITY)
continue;
Expand Down
2 changes: 1 addition & 1 deletion t/t6500-gc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test_expect_success TTY 'with TTY: gc --no-quiet' '
git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr &&
test_must_be_empty stdout &&
test_grep "Enumerating objects" stderr &&
test_grep "Computing commit graph generation numbers" stderr
test_grep "Computing commit graph generation numbers: 100% (4/4), done." stderr
'

test_expect_success 'gc --quiet' '
Expand Down

0 comments on commit 3fa7b62

Please sign in to comment.