diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-20 22:29:54 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-20 22:29:54 (GMT) |
commit | c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8 (patch) | |
tree | 0c9e688081200f8984a6ac8850483c63c0ca8649 /t/helper/test-read-midx.c | |
parent | 7e8bfb0412581daf8f3c89909f1d37844e8610dd (diff) | |
parent | 525e18c04bb38450e6677bb2aa5c65b78254b5c2 (diff) | |
download | git-c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8.zip git-c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8.tar.gz git-c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8.tar.bz2 |
Sync 'ds/multi-pack-index' to v2.19.0-rc0
* ds/multi-pack-index: (23 commits)
midx: clear midx on repack
packfile: skip loading index if in multi-pack-index
midx: prevent duplicate packfile loads
midx: use midx in approximate_object_count
midx: use existing midx when writing new one
midx: use midx in abbreviation calculations
midx: read objects from multi-pack-index
config: create core.multiPackIndex setting
midx: write object offsets
midx: write object id fanout chunk
midx: write object ids in a chunk
midx: sort and deduplicate objects from packfiles
midx: read pack names into array
multi-pack-index: write pack names in chunk
multi-pack-index: read packfile list
packfile: generalize pack directory list
t5319: expand test data
multi-pack-index: load into memory
midx: write header information to lockfile
multi-pack-index: add 'write' verb
...
Diffstat (limited to 't/helper/test-read-midx.c')
-rw-r--r-- | t/helper/test-read-midx.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c new file mode 100644 index 0000000..8e19972 --- /dev/null +++ b/t/helper/test-read-midx.c @@ -0,0 +1,51 @@ +#include "test-tool.h" +#include "cache.h" +#include "midx.h" +#include "repository.h" +#include "object-store.h" + +static int read_midx_file(const char *object_dir) +{ + uint32_t i; + struct multi_pack_index *m = load_multi_pack_index(object_dir); + + if (!m) + return 1; + + printf("header: %08x %d %d %d\n", + m->signature, + m->version, + m->num_chunks, + m->num_packs); + + printf("chunks:"); + + if (m->chunk_pack_names) + printf(" pack-names"); + if (m->chunk_oid_fanout) + printf(" oid-fanout"); + if (m->chunk_oid_lookup) + printf(" oid-lookup"); + if (m->chunk_object_offsets) + printf(" object-offsets"); + if (m->chunk_large_offsets) + printf(" large-offsets"); + + printf("\nnum_objects: %d\n", m->num_objects); + + printf("packs:\n"); + for (i = 0; i < m->num_packs; i++) + printf("%s\n", m->pack_names[i]); + + printf("object-dir: %s\n", m->object_dir); + + return 0; +} + +int cmd__read_midx(int argc, const char **argv) +{ + if (argc != 2) + usage("read-midx <object-dir>"); + + return read_midx_file(argv[1]); +} |