]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-read-graph.c
range-diff(docs): explain how to specify commit ranges
[thirdparty/git.git] / t / helper / test-read-graph.c
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "commit-graph.h"
4 #include "repository.h"
5 #include "object-store.h"
6
7 int cmd__read_graph(int argc, const char **argv)
8 {
9 struct commit_graph *graph = NULL;
10 struct object_directory *odb;
11
12 setup_git_directory();
13 odb = the_repository->objects->odb;
14
15 prepare_repo_settings(the_repository);
16
17 graph = read_commit_graph_one(the_repository, odb);
18 if (!graph)
19 return 1;
20
21 printf("header: %08x %d %d %d %d\n",
22 ntohl(*(uint32_t*)graph->data),
23 *(unsigned char*)(graph->data + 4),
24 *(unsigned char*)(graph->data + 5),
25 *(unsigned char*)(graph->data + 6),
26 *(unsigned char*)(graph->data + 7));
27 printf("num_commits: %u\n", graph->num_commits);
28 printf("chunks:");
29
30 if (graph->chunk_oid_fanout)
31 printf(" oid_fanout");
32 if (graph->chunk_oid_lookup)
33 printf(" oid_lookup");
34 if (graph->chunk_commit_data)
35 printf(" commit_metadata");
36 if (graph->chunk_extra_edges)
37 printf(" extra_edges");
38 if (graph->chunk_bloom_indexes)
39 printf(" bloom_indexes");
40 if (graph->chunk_bloom_data)
41 printf(" bloom_data");
42 printf("\n");
43
44 UNLEAK(graph);
45
46 return 0;
47 }