]>
Commit | Line | Data |
---|---|---|
4d80560c DS |
1 | #include "test-tool.h" |
2 | #include "cache.h" | |
3 | #include "midx.h" | |
4 | #include "repository.h" | |
5 | #include "object-store.h" | |
6 | ||
7 | static int read_midx_file(const char *object_dir) | |
8 | { | |
3227565c | 9 | uint32_t i; |
4d80560c DS |
10 | struct multi_pack_index *m = load_multi_pack_index(object_dir); |
11 | ||
12 | if (!m) | |
13 | return 1; | |
14 | ||
15 | printf("header: %08x %d %d %d\n", | |
16 | m->signature, | |
17 | m->version, | |
18 | m->num_chunks, | |
19 | m->num_packs); | |
20 | ||
32f3c541 DS |
21 | printf("chunks:"); |
22 | ||
23 | if (m->chunk_pack_names) | |
24 | printf(" pack-names"); | |
0d5b3a5e DS |
25 | if (m->chunk_oid_lookup) |
26 | printf(" oid-lookup"); | |
32f3c541 DS |
27 | |
28 | printf("\n"); | |
29 | ||
3227565c DS |
30 | printf("packs:\n"); |
31 | for (i = 0; i < m->num_packs; i++) | |
32 | printf("%s\n", m->pack_names[i]); | |
33 | ||
4d80560c DS |
34 | printf("object-dir: %s\n", m->object_dir); |
35 | ||
36 | return 0; | |
37 | } | |
38 | ||
39 | int cmd__read_midx(int argc, const char **argv) | |
40 | { | |
41 | if (argc != 2) | |
42 | usage("read-midx <object-dir>"); | |
43 | ||
44 | return read_midx_file(argv[1]); | |
45 | } |