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 ...
This commit is contained in:
51
t/helper/test-read-midx.c
Normal file
51
t/helper/test-read-midx.c
Normal file
@ -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]);
|
||||
}
|
@ -28,6 +28,7 @@ static struct test_cmd cmds[] = {
|
||||
{ "path-utils", cmd__path_utils },
|
||||
{ "prio-queue", cmd__prio_queue },
|
||||
{ "read-cache", cmd__read_cache },
|
||||
{ "read-midx", cmd__read_midx },
|
||||
{ "ref-store", cmd__ref_store },
|
||||
{ "regex", cmd__regex },
|
||||
{ "repository", cmd__repository },
|
||||
|
@ -22,6 +22,7 @@ int cmd__online_cpus(int argc, const char **argv);
|
||||
int cmd__path_utils(int argc, const char **argv);
|
||||
int cmd__prio_queue(int argc, const char **argv);
|
||||
int cmd__read_cache(int argc, const char **argv);
|
||||
int cmd__read_midx(int argc, const char **argv);
|
||||
int cmd__ref_store(int argc, const char **argv);
|
||||
int cmd__regex(int argc, const char **argv);
|
||||
int cmd__repository(int argc, const char **argv);
|
||||
|
Reference in New Issue
Block a user