From 6f9d5f2fda1f94cf1539d3e0529c2b2e7ee7eebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Thu, 9 Jul 2020 18:54:32 +0200 Subject: [PATCH 1/2] commit-graph: fix progress of reachable commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To display a progress line while iterating over all refs, d335ce8f24 (commit-graph.c: show progress of finding reachable commits, 2020-05-13) should have added a pair of start_delayed_progress() and stop_progress() calls around a for_each_ref() invocation. Alas, the stop_progress() call ended up at the wrong place, after write_commit_graph(), which does all the commit-graph computation and writing, and has several progress lines of its own. Consequently, that new Collecting referenced commits: 123 progress line is overwritten by the first progress line shown by write_commit_graph(), and its final "done" line is shown last, after everything is finished: Expanding reachable commits in commit graph: 344786, done. Computing commit changed paths Bloom filters: 100% (344786/344786), done. Collecting referenced commits: 154, done. Move that stop_progress() call to the right place. While at it, drop the unnecessary 'if (data.progress)' condition protecting the stop_progress() call, because that function is prepared to handle a NULL progress struct. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- commit-graph.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index 5df3e08718..aaf3327ede 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1354,12 +1354,13 @@ int write_commit_graph_reachable(struct object_directory *odb, _("Collecting referenced commits"), 0); for_each_ref(add_ref_to_set, &data); + + stop_progress(&data.progress); + result = write_commit_graph(odb, NULL, &commits, flags, split_opts); oidset_clear(&commits); - if (data.progress) - stop_progress(&data.progress); return result; } From 150cd3b61d55bedd275e0ed36a6f674dcd34ae25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Thu, 9 Jul 2020 19:00:03 +0200 Subject: [PATCH 2/2] commit-graph: fix "Writing out commit graph" progress counter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 76ffbca71a (commit-graph: write Bloom filters to commit graph file, 2020-04-06) added two delayed progress lines to writing the Bloom filter index and data chunk. This is wrong, because a single common progress is used while writing all chunks, which is not updated while writing these two new chunks, resulting in incomplete-looking "done" lines: Expanding reachable commits in commit graph: 888679, done. Computing commit changed paths Bloom filters: 100% (888678/888678), done. Writing out commit graph in 6 passes: 66% (3554712/5332068), done. Use the common 'struct progress' instance while writing the Bloom filter chunks as well. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- commit-graph.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/commit-graph.c b/commit-graph.c index aaf3327ede..65cf32637c 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1086,23 +1086,14 @@ static void write_graph_chunk_bloom_indexes(struct hashfile *f, struct commit **list = ctx->commits.list; struct commit **last = ctx->commits.list + ctx->commits.nr; uint32_t cur_pos = 0; - struct progress *progress = NULL; - int i = 0; - - if (ctx->report_progress) - progress = start_delayed_progress( - _("Writing changed paths Bloom filters index"), - ctx->commits.nr); while (list < last) { struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0); cur_pos += filter->len; - display_progress(progress, ++i); + display_progress(ctx->progress, ++ctx->progress_cnt); hashwrite_be32(f, cur_pos); list++; } - - stop_progress(&progress); } static void write_graph_chunk_bloom_data(struct hashfile *f, @@ -1111,13 +1102,6 @@ static void write_graph_chunk_bloom_data(struct hashfile *f, { struct commit **list = ctx->commits.list; struct commit **last = ctx->commits.list + ctx->commits.nr; - struct progress *progress = NULL; - int i = 0; - - if (ctx->report_progress) - progress = start_delayed_progress( - _("Writing changed paths Bloom filters data"), - ctx->commits.nr); hashwrite_be32(f, settings->hash_version); hashwrite_be32(f, settings->num_hashes); @@ -1125,12 +1109,10 @@ static void write_graph_chunk_bloom_data(struct hashfile *f, while (list < last) { struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0); - display_progress(progress, ++i); + display_progress(ctx->progress, ++ctx->progress_cnt); hashwrite(f, filter->data, filter->len * sizeof(unsigned char)); list++; } - - stop_progress(&progress); } static int oid_compare(const void *_a, const void *_b)