]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-read-graph.c
t/helper/test-read-graph.c: prepare repo settings
[thirdparty/git.git] / t / helper / test-read-graph.c
CommitLineData
4bd0593e
DS
1#include "test-tool.h"
2#include "cache.h"
3#include "commit-graph.h"
4#include "repository.h"
5#include "object-store.h"
6
7int cmd__read_graph(int argc, const char **argv)
8{
9 struct commit_graph *graph = NULL;
ad2dd5bb 10 struct object_directory *odb;
4bd0593e
DS
11
12 setup_git_directory();
ad2dd5bb 13 odb = the_repository->objects->odb;
4bd0593e 14
24f951a4
TB
15 prepare_repo_settings(the_repository);
16
2fa05f31 17 graph = read_commit_graph_one(the_repository, odb);
4bd0593e
DS
18 if (!graph)
19 return 1;
20
4bd0593e
DS
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");
a759bfa9
GS
38 if (graph->chunk_bloom_indexes)
39 printf(" bloom_indexes");
40 if (graph->chunk_bloom_data)
41 printf(" bloom_data");
4bd0593e
DS
42 printf("\n");
43
44 UNLEAK(graph);
45
46 return 0;
47}