git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] commit-graph: fix progress of reachable commits

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jul 9, 2020, 16:54 UTC
Message-ID
<20200709165432.2688-1-szeder.dev@gmail.com>

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 <szeder.dev@gmail.com>
---
 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;
 }
 
-- 
2.27.0.547.g4ba2d26563
Next: Junio C Hamano
Message 1 of 2 in “commit-graph: fix progress of reachable commits”
  1. commit-graph: fix progress of reachable commitsSZEDER Gábor, Jul 9, 2020
  2. Junio C HamanoJul 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.