setup.h: move declarations for setup.c functions from cache.h
[git.git] / t / helper / test-dump-split-index.c
blob289a01c10acbed2508b1437cd3ffa841574d4376
1 #define USE_THE_INDEX_VARIABLE
2 #include "test-tool.h"
3 #include "cache.h"
4 #include "hex.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)
11 printf(" %d", (int)pos);
14 int cmd__dump_split_index(int ac, const char **av)
16 struct split_index *si;
17 int i;
19 setup_git_directory();
21 do_read_index(&the_index, av[1], 1);
22 printf("own %s\n", oid_to_hex(&the_index.oid));
23 si = the_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_index.cache_nr; i++) {
30 struct cache_entry *ce = the_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;