submodule--helper: teach config subcommand --unset
[git/raj.git] / t / helper / test-read-midx.c
blob831b586d022215ff75b4e426d79e7149b3bfb3bb
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "midx.h"
4 #include "repository.h"
5 #include "object-store.h"
7 static int read_midx_file(const char *object_dir)
9 uint32_t i;
10 struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
12 if (!m)
13 return 1;
15 printf("header: %08x %d %d %d\n",
16 m->signature,
17 m->version,
18 m->num_chunks,
19 m->num_packs);
21 printf("chunks:");
23 if (m->chunk_pack_names)
24 printf(" pack-names");
25 if (m->chunk_oid_fanout)
26 printf(" oid-fanout");
27 if (m->chunk_oid_lookup)
28 printf(" oid-lookup");
29 if (m->chunk_object_offsets)
30 printf(" object-offsets");
31 if (m->chunk_large_offsets)
32 printf(" large-offsets");
34 printf("\nnum_objects: %d\n", m->num_objects);
36 printf("packs:\n");
37 for (i = 0; i < m->num_packs; i++)
38 printf("%s\n", m->pack_names[i]);
40 printf("object-dir: %s\n", m->object_dir);
42 return 0;
45 int cmd__read_midx(int argc, const char **argv)
47 if (argc != 2)
48 usage("read-midx <object-dir>");
50 return read_midx_file(argv[1]);