]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-dump-split-index.c
ci: deprecate ci/config/allow-ref script
[thirdparty/git.git] / t / helper / test-dump-split-index.c
1 #define USE_THE_INDEX_VARIABLE
2 #include "test-tool.h"
3 #include "cache.h"
4 #include "split-index.h"
5 #include "ewah/ewok.h"
6
7 static void show_bit(size_t pos, void *data)
8 {
9 printf(" %d", (int)pos);
10 }
11
12 int cmd__dump_split_index(int ac, const char **av)
13 {
14 struct split_index *si;
15 int i;
16
17 setup_git_directory();
18
19 do_read_index(&the_index, av[1], 1);
20 printf("own %s\n", oid_to_hex(&the_index.oid));
21 si = the_index.split_index;
22 if (!si) {
23 printf("not a split index\n");
24 return 0;
25 }
26 printf("base %s\n", oid_to_hex(&si->base_oid));
27 for (i = 0; i < the_index.cache_nr; i++) {
28 struct cache_entry *ce = the_index.cache[i];
29 printf("%06o %s %d\t%s\n", ce->ce_mode,
30 oid_to_hex(&ce->oid), ce_stage(ce), ce->name);
31 }
32 printf("replacements:");
33 if (si->replace_bitmap)
34 ewah_each_bit(si->replace_bitmap, show_bit, NULL);
35 printf("\ndeletions:");
36 if (si->delete_bitmap)
37 ewah_each_bit(si->delete_bitmap, show_bit, NULL);
38 printf("\n");
39 return 0;
40 }