From 2bd0365f374558ca053412966b51fe01885ea3b5 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Wed, 27 Jun 2018 09:24:34 -0400 Subject: commit-graph: verify required chunks are present The commit-graph file requires the following three chunks: * OID Fanout * OID Lookup * Commit Data If any of these are missing, then the 'verify' subcommand should report a failure. This includes the chunk IDs malformed or the chunk count is truncated. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index 488216a736..26328c3b74 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -848,5 +848,14 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g) return 1; } + verify_commit_graph_error = 0; + + if (!g->chunk_oid_fanout) + graph_report("commit-graph is missing the OID Fanout chunk"); + if (!g->chunk_oid_lookup) + graph_report("commit-graph is missing the OID Lookup chunk"); + if (!g->chunk_commit_data) + graph_report("commit-graph is missing the Commit Data chunk"); + return verify_commit_graph_error; } -- cgit v1.2.1