treewide: remove cache.h inclusion due to setup.h changes
[alt-git.git] / t / helper / test-read-graph.c
blob78965a6ebdc101f5753fb0e09b4ec1a4fc482378
1 #include "test-tool.h"
2 #include "commit-graph.h"
3 #include "repository.h"
4 #include "object-store.h"
5 #include "bloom.h"
6 #include "setup.h"
8 int cmd__read_graph(int argc, const char **argv)
10 struct commit_graph *graph = NULL;
11 struct object_directory *odb;
13 setup_git_directory();
14 odb = the_repository->objects->odb;
16 prepare_repo_settings(the_repository);
18 graph = read_commit_graph_one(the_repository, odb);
19 if (!graph)
20 return 1;
22 printf("header: %08x %d %d %d %d\n",
23 ntohl(*(uint32_t*)graph->data),
24 *(unsigned char*)(graph->data + 4),
25 *(unsigned char*)(graph->data + 5),
26 *(unsigned char*)(graph->data + 6),
27 *(unsigned char*)(graph->data + 7));
28 printf("num_commits: %u\n", graph->num_commits);
29 printf("chunks:");
31 if (graph->chunk_oid_fanout)
32 printf(" oid_fanout");
33 if (graph->chunk_oid_lookup)
34 printf(" oid_lookup");
35 if (graph->chunk_commit_data)
36 printf(" commit_metadata");
37 if (graph->chunk_generation_data)
38 printf(" generation_data");
39 if (graph->chunk_generation_data_overflow)
40 printf(" generation_data_overflow");
41 if (graph->chunk_extra_edges)
42 printf(" extra_edges");
43 if (graph->chunk_bloom_indexes)
44 printf(" bloom_indexes");
45 if (graph->chunk_bloom_data)
46 printf(" bloom_data");
47 printf("\n");
49 printf("options:");
50 if (graph->bloom_filter_settings)
51 printf(" bloom(%"PRIu32",%"PRIu32",%"PRIu32")",
52 graph->bloom_filter_settings->hash_version,
53 graph->bloom_filter_settings->bits_per_entry,
54 graph->bloom_filter_settings->num_hashes);
55 if (graph->read_generation_data)
56 printf(" read_generation_data");
57 if (graph->topo_levels)
58 printf(" topo_levels");
59 printf("\n");
61 UNLEAK(graph);
63 return 0;