Merge branch 'mh/find-uniq-abbrev'
[git] / test-dump-split-index.c
1 #include "cache.h"
2 #include "split-index.h"
3 #include "ewah/ewok.h"
4
5 static void show_bit(size_t pos, void *data)
6 {
7         printf(" %d", (int)pos);
8 }
9
10 int main(int ac, char **av)
11 {
12         struct split_index *si;
13         int i;
14
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;
21         }
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);
27         }
28         printf("replacements:");
29         ewah_each_bit(si->replace_bitmap, show_bit, NULL);
30         printf("\ndeletions:");
31         ewah_each_bit(si->delete_bitmap, show_bit, NULL);
32         printf("\n");
33         return 0;
34 }