Thread (8 messages) 8 messages, 2 authors, 2023-07-10
STALE1112d

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

From: Taylor Blau <hidden>
Date: 2023-07-08 00:31:49
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help