Merge branch 'jk/test-chain-lint'
[git/mingw.git] / test-dump-split-index.c
blob9cf3112c9d384c98e68b0fc2c10b5d83b5136c18
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 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;