commit-graph: add 'verify' subcommand
[gitweb.git] / commit-graph.c
index 9e228d3bb5aa108424f53a1003b1b5cd36ff77d1..488216a736c272292641323d10681c6eece1ea3f 100644 (file)
@@ -827,3 +827,26 @@ void write_commit_graph(const char *obj_dir,
        oids.alloc = 0;
        oids.nr = 0;
 }
+
+static int verify_commit_graph_error;
+
+static void graph_report(const char *fmt, ...)
+{
+       va_list ap;
+
+       verify_commit_graph_error = 1;
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fprintf(stderr, "\n");
+       va_end(ap);
+}
+
+int verify_commit_graph(struct repository *r, struct commit_graph *g)
+{
+       if (!g) {
+               graph_report("no commit-graph file loaded");
+               return 1;
+       }
+
+       return verify_commit_graph_error;
+}