On Wed, Feb 24, 2021 at 05:52:42PM +0100, SZEDER Gábor wrote: > On Thu, Feb 18, 2021 at 02:07:25PM +0000, Derrick Stolee via GitGitGadget wrote: > > From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > > > > The commit-graph write logic is ready to make use of the chunk-format > > write API. Each chunk write method is already in the correct prototype. > > We only need to use the 'struct chunkfile' pointer and the correct API > > calls. > > This patch series messes up the "Writing out commit graph" progress > display, and starting at this commit I get: I can confirm. It looks like we never dropped the 'num_chunks' variable, which should have happened in this patch. Here's something to apply on top which fixes the issue. Thanks for reporting. --- >8 --- Subject: [PATCH] commit-graph.c: display correct number of chunks when writing When writing a commit-graph, a progress meter is shown which indicates the number of pieces of data to write (one per commit in each chunk). In 47410aa837 (commit-graph: use chunk-format write API, 2021-02-18), the number of chunks became tracked by the new chunk-format API. But a stray local variable was left behind from when write_commit_graph_file() used to keep track of the same. Since this was no longer updated after 47410aa837, the progress meter appeared broken: $ git commit-graph write --reachable Expanding reachable commits in commit graph: 837569, done. Writing out commit graph in 3 passes: 166% (4187845/2512707), done. Drop the local variable and rely instead on the chunk-format API to tell us the correct number of chunks. Reported-by: SZEDER Gábor <szeder.dev@xxxxxxxxx> Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- commit-graph.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index 78b993c367..6aa0c488f5 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1791,7 +1791,6 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx) struct lock_file lk = LOCK_INIT; const unsigned hashsz = the_hash_algo->rawsz; struct strbuf progress_title = STRBUF_INIT; - int num_chunks = 3; struct object_id file_hash; struct chunkfile *cf; @@ -1887,11 +1886,11 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx) strbuf_addf(&progress_title, Q_("Writing out commit graph in %d pass", "Writing out commit graph in %d passes", - num_chunks), - num_chunks); + get_num_chunks(cf)), + get_num_chunks(cf)); ctx->progress = start_delayed_progress( progress_title.buf, - num_chunks * ctx->commits.nr); + get_num_chunks(cf) * ctx->commits.nr); } write_chunkfile(cf, ctx); -- 2.30.0.667.g81c0cbc6fd