Merge branch 'jk/rerere-xsnprintf'
[git/debian.git] / test-dump-split-index.c
blob861d28c9b6c1b4d95f74ffbd95bc279ea0d377eb
1 #include "cache.h"
2 #include "split-index.h"
3 #include "ewah/ewok.h"
5 static void show_bit(size_t pos, void *data)
7 printf(" %d", (int)pos);
10 int main(int ac, char **av)
12 struct split_index *si;
13 int i;
15 do_read_index(&the_index, av[1], 1);
16 printf("own %s\n", sha1_to_hex(the_index.sha1));
17 si = the_index.split_index;
18 if (!si) {
19 printf("not a split index\n");
20 return 0;
22 printf("base %s\n", sha1_to_hex(si->base_sha1));
23 for (i = 0; i < the_index.cache_nr; i++) {
24 struct cache_entry *ce = the_index.cache[i];
25 printf("%06o %s %d\t%s\n", ce->ce_mode,
26 sha1_to_hex(ce->sha1), ce_stage(ce), ce->name);
28 printf("replacements:");
29 if (si->replace_bitmap)
30 ewah_each_bit(si->replace_bitmap, show_bit, NULL);
31 printf("\ndeletions:");
32 if (si->delete_bitmap)
33 ewah_each_bit(si->delete_bitmap, show_bit, NULL);
34 printf("\n");
35 return 0;