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