t/helper: stop using `the_index`
[git.git] / t / helper / test-dump-split-index.c
blobf472691a3ca95b14266cdc0c0f64ce26d9daa323
1 #include "test-tool.h"
2 #include "hex.h"
3 #include "read-cache-ll.h"
4 #include "repository.h"
5 #include "setup.h"
6 #include "split-index.h"
7 #include "ewah/ewok.h"
9 static void show_bit(size_t pos, void *data UNUSED)
11 printf(" %d", (int)pos);
14 int cmd__dump_split_index(int ac UNUSED, const char **av)
16 struct split_index *si;
17 int i;
19 setup_git_directory();
21 do_read_index(the_repository->index, av[1], 1);
22 printf("own %s\n", oid_to_hex(&the_repository->index->oid));
23 si = the_repository->index->split_index;
24 if (!si) {
25 printf("not a split index\n");
26 return 0;
28 printf("base %s\n", oid_to_hex(&si->base_oid));
29 for (i = 0; i < the_repository->index->cache_nr; i++) {
30 struct cache_entry *ce = the_repository->index->cache[i];
31 printf("%06o %s %d\t%s\n", ce->ce_mode,
32 oid_to_hex(&ce->oid), ce_stage(ce), ce->name);
34 printf("replacements:");
35 if (si->replace_bitmap)
36 ewah_each_bit(si->replace_bitmap, show_bit, NULL);
37 printf("\ndeletions:");
38 if (si->delete_bitmap)
39 ewah_each_bit(si->delete_bitmap, show_bit, NULL);
40 printf("\n");
41 return 0;