From 283e68c72f49e6cfbae53cb5547d5b399ed25d1a Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Wed, 27 Jun 2018 09:24:32 -0400 Subject: commit-graph: add 'verify' subcommand If the commit-graph file becomes corrupt, we need a way to verify that its contents match the object database. In the manner of 'git fsck' we will implement a 'git commit-graph verify' subcommand to report all issues with the file. Add the 'verify' subcommand to the 'commit-graph' builtin and its documentation. The subcommand is currently a no-op except for loading the commit-graph into memory, which may trigger run-time errors that would be caught by normal use. Add a simple test that ensures the command returns a zero error code. If no commit-graph file exists, this is an acceptable state. Do not report any errors. Helped-by: Ramsay Jones Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'commit-graph.h') diff --git a/commit-graph.h b/commit-graph.h index 96cccb10f3..4359812fb4 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -2,6 +2,7 @@ #define COMMIT_GRAPH_H #include "git-compat-util.h" +#include "repository.h" char *get_commit_graph_filename(const char *obj_dir); @@ -53,4 +54,6 @@ void write_commit_graph(const char *obj_dir, int nr_commits, int append); +int verify_commit_graph(struct repository *r, struct commit_graph *g); + #endif -- cgit v1.2.3