]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-read-graph.c
Merge branch 'bb/unicode-width-table-15'
[thirdparty/git.git] / t / helper / test-read-graph.c
CommitLineData
4bd0593e 1#include "test-tool.h"
4bd0593e
DS
2#include "commit-graph.h"
3#include "repository.h"
a034e910 4#include "object-store-ll.h"
c78c7a95 5#include "bloom.h"
e38da487 6#include "setup.h"
4bd0593e 7
126e3b3d 8int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
4bd0593e
DS
9{
10 struct commit_graph *graph = NULL;
ad2dd5bb 11 struct object_directory *odb;
4bd0593e
DS
12
13 setup_git_directory();
ad2dd5bb 14 odb = the_repository->objects->odb;
4bd0593e 15
24f951a4
TB
16 prepare_repo_settings(the_repository);
17
2fa05f31 18 graph = read_commit_graph_one(the_repository, odb);
4bd0593e
DS
19 if (!graph)
20 return 1;
21
4bd0593e
DS
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:");
30
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");
e8b63005
AK
37 if (graph->chunk_generation_data)
38 printf(" generation_data");
39 if (graph->chunk_generation_data_overflow)
40 printf(" generation_data_overflow");
4bd0593e
DS
41 if (graph->chunk_extra_edges)
42 printf(" extra_edges");
a759bfa9
GS
43 if (graph->chunk_bloom_indexes)
44 printf(" bloom_indexes");
45 if (graph->chunk_bloom_data)
46 printf(" bloom_data");
4bd0593e
DS
47 printf("\n");
48
c78c7a95
DS
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");
60
4bd0593e
DS
61 UNLEAK(graph);
62
63 return 0;
64}