]>
Commit | Line | Data |
---|---|---|
bdafeae0 | 1 | #define USE_THE_INDEX_VARIABLE |
8133061e | 2 | #include "test-tool.h" |
3e52f70b | 3 | #include "cache.h" |
41771fa4 | 4 | #include "hex.h" |
3e52f70b NTND |
5 | #include "split-index.h" |
6 | #include "ewah/ewok.h" | |
7 | ||
8 | static void show_bit(size_t pos, void *data) | |
9 | { | |
10 | printf(" %d", (int)pos); | |
11 | } | |
12 | ||
8133061e | 13 | int cmd__dump_split_index(int ac, const char **av) |
3e52f70b NTND |
14 | { |
15 | struct split_index *si; | |
16 | int i; | |
17 | ||
6946e525 | 18 | setup_git_directory(); |
19 | ||
3e52f70b | 20 | do_read_index(&the_index, av[1], 1); |
75691ea3 | 21 | printf("own %s\n", oid_to_hex(&the_index.oid)); |
3e52f70b NTND |
22 | si = the_index.split_index; |
23 | if (!si) { | |
24 | printf("not a split index\n"); | |
25 | return 0; | |
26 | } | |
2182abd9 | 27 | printf("base %s\n", oid_to_hex(&si->base_oid)); |
3e52f70b NTND |
28 | for (i = 0; i < the_index.cache_nr; i++) { |
29 | struct cache_entry *ce = the_index.cache[i]; | |
30 | printf("%06o %s %d\t%s\n", ce->ce_mode, | |
99d1a986 | 31 | oid_to_hex(&ce->oid), ce_stage(ce), ce->name); |
3e52f70b NTND |
32 | } |
33 | printf("replacements:"); | |
475a3445 DT |
34 | if (si->replace_bitmap) |
35 | ewah_each_bit(si->replace_bitmap, show_bit, NULL); | |
3e52f70b | 36 | printf("\ndeletions:"); |
475a3445 DT |
37 | if (si->delete_bitmap) |
38 | ewah_each_bit(si->delete_bitmap, show_bit, NULL); | |
3e52f70b NTND |
39 | printf("\n"); |
40 | return 0; | |
41 | } |