3 #include "commit-graph.h"
4 #include "repository.h"
5 #include "object-store.h"
7 int cmd__read_graph(int argc, const char **argv)
9 struct commit_graph *graph = NULL;
14 struct object_directory *odb;
16 setup_git_directory();
17 odb = the_repository->objects->odb;
19 graph_name = get_commit_graph_filename(odb);
21 open_ok = open_commit_graph(graph_name, &fd, &st);
23 die_errno(_("Could not open commit-graph '%s'"), graph_name);
25 graph = load_commit_graph_one_fd_st(fd, &st, odb);
29 FREE_AND_NULL(graph_name);
31 printf("header: %08x %d %d %d %d\n",
32 ntohl(*(uint32_t*)graph->data),
33 *(unsigned char*)(graph->data + 4),
34 *(unsigned char*)(graph->data + 5),
35 *(unsigned char*)(graph->data + 6),
36 *(unsigned char*)(graph->data + 7));
37 printf("num_commits: %u\n", graph->num_commits);
40 if (graph->chunk_oid_fanout)
41 printf(" oid_fanout");
42 if (graph->chunk_oid_lookup)
43 printf(" oid_lookup");
44 if (graph->chunk_commit_data)
45 printf(" commit_metadata");
46 if (graph->chunk_extra_edges)
47 printf(" extra_edges");