Skip to content

Commit c4ff24b

Browse files
ttaylorrgitster
authored andcommitted
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 47410aa (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 47410aa, 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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a43a2e6 commit c4ff24b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

commit-graph.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,6 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
17151715
struct lock_file lk = LOCK_INIT;
17161716
const unsigned hashsz = the_hash_algo->rawsz;
17171717
struct strbuf progress_title = STRBUF_INIT;
1718-
int num_chunks = 3;
17191718
struct object_id file_hash;
17201719
struct chunkfile *cf;
17211720

@@ -1811,11 +1810,11 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
18111810
strbuf_addf(&progress_title,
18121811
Q_("Writing out commit graph in %d pass",
18131812
"Writing out commit graph in %d passes",
1814-
num_chunks),
1815-
num_chunks);
1813+
get_num_chunks(cf)),
1814+
get_num_chunks(cf));
18161815
ctx->progress = start_delayed_progress(
18171816
progress_title.buf,
1818-
num_chunks * ctx->commits.nr);
1817+
get_num_chunks(cf) * ctx->commits.nr);
18191818
}
18201819

18211820
write_chunkfile(cf, ctx);

0 commit comments

Comments
 (0)