aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-07-07 20:31:39 -0400
committerJunio C Hamano <gitster@pobox.com>2023-07-10 10:02:42 -0700
commitf5facaa4653d3bcdb5ad5508e47d0e9a03c2aaa5 (patch)
treed52fb4520137136d1ad3ecc2ebb932a30184733f /commit-graph.c
parenteb319d6771f5829dc26499af93050350083adc7d (diff)
downloadgit-f5facaa4653d3bcdb5ad5508e47d0e9a03c2aaa5.tar.gz
commit-graph.c: iteratively verify commit-graph chains
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> Acked-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/commit-graph.c b/commit-graph.c
index e846920935..bb56733d8c 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2708,10 +2708,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;
}