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

[PATCH 4/6] commit-graph.c: iteratively verify commit-graph chains

From
Taylor Blau <me@ttaylorr.com>
Date
Jul 8, 2023, 00:31 UTC
Message-ID
<4006bbf08548a8482d0aa4d4f3880de75ebf3c51.1688776280.git.me@ttaylorr.com>
In-Reply-To
<cover.1688776280.git.me@ttaylorr.com>

Now that we have a function which can verify a single layer of a commit-graph chain, implement `verify_commit_graph()` in terms of iterating over commit-graphs along their `->base_graph` pointers.

This further prepares us to consolidate the progress output of `git commit-graph verify`.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 commit-graph.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/commit-graph.c b/commit-graph.c
index 3d7cc11927d..3c29ea7c706 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2707,10 +2707,11 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
 		return 1;
 	}
 
-	local_error = verify_one_commit_graph(r, g, flags);
-
-	if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW) && g->base_graph)
-		local_error |= verify_commit_graph(r, g->base_graph, flags);
+	for (; g; g = g->base_graph) {
+		local_error |= verify_one_commit_graph(r, g, flags);
+		if (flags & COMMIT_GRAPH_VERIFY_SHALLOW)
+			break;
+	}
 
 	return local_error;
 }
-- 
2.41.0.242.g6eec849fa5a
Previous: Taylor BlauNext: Taylor Blau
Message 5 of 8 in “fsck: squelch progress output with `--no-progress`”
  1. 0/6 fsck: squelch progress output with `--no-progress`Taylor Blau, Jul 8, 2023
  2. 1/6 fsck: suppress commit-graph output with `--no-progress`Taylor Blau, Jul 8, 2023
  3. 2/6 fsck: suppress MIDX output with `--no-progress`Taylor Blau, Jul 8, 2023
  4. 3/6 commit-graph.c: extract `verify_one_commit_graph()`Taylor Blau, Jul 8, 2023
  5. 4/6 commit-graph.c: iteratively verify commit-graph chainsTaylor Blau, Jul 8, 2023
  6. 5/6 commit-graph.c: pass progress to `verify_one_commit_graph()`Taylor Blau, Jul 8, 2023
  7. 6/6 commit-graph.c: avoid duplicated progress output during `verify`Taylor Blau, Jul 8, 2023
  8. Derrick StoleeJul 10, 2023

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.