Skip to content

Commit 67fa6aa

Browse files
szedergitster
authored andcommitted
commit-graph: don't show progress percentages while expanding reachable commits
Commit 49bbc57 (commit-graph write: emit a percentage for all progress, 2019-01-19) was a bit overeager when it added progress percentages to the "Expanding reachable commits in commit graph" phase as well, because most of the time the number of commits that phase has to iterate over is not known in advance and grows significantly, and, consequently, we end up with nonsensical numbers: $ git commit-graph write --reachable Expanding reachable commits in commit graph: 138606% (824706/595), done. [...] $ git rev-parse v5.0 | git commit-graph write --stdin-commits Expanding reachable commits in commit graph: 81264400% (812644/1), done. [...] Even worse, because the percentage grows so quickly, the progress code outputs much more often than it should (because it ticks every second, or every 1%), slowing the whole process down. My time for "git commit-graph write --reachable" on linux.git went from 13.463s to 12.521s with this patch, ~7% savings. Therefore, don't show progress percentages in the "Expanding reachable commits in commit graph" phase. Note that the current code does sometimes do the right thing, if we picked up all commits initially (e.g., omitting "--reachable" in a fully-packed repository would get the correct count without any parent traversal). So it may be possible to come up with a way to tell when we could use a percentage here. But in the meantime, let's make sure we robustly avoid printing nonsense. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit 67fa6aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
10491049
if (ctx->report_progress)
10501050
ctx->progress = start_delayed_progress(
10511051
_("Expanding reachable commits in commit graph"),
1052-
ctx->oids.nr);
1052+
0);
10531053
for (i = 0; i < ctx->oids.nr; i++) {
10541054
display_progress(ctx->progress, i + 1);
10551055
commit = lookup_commit(ctx->r, &ctx->oids.list[i]);

0 commit comments

Comments
 (0)