mirror of
https://github.com/git/git.git
synced 2024-06-10 16:56:43 +02:00
The final pair of chunks for the multi-pack-index file stores the object offsets. We default to using 32-bit offsets as in the pack-index version 1 format, but if there exists an offset larger than 32-bits, we use a trick similar to the pack-index version 2 format by storing all offsets at least 2^31 in a 64-bit table; we use the 32-bit table to point into that 64-bit table as necessary. We only store these 64-bit offsets if necessary, so create a test that manipulates a version 2 pack-index to fake a large offset. This allows us to test that the large offset table is created, but the data does not match the actual packfile offsets. The multi-pack-index offset does match the (corrupted) pack-index offset, so a future feature will compare these offsets during a 'verify' step. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
32 lines
653 B
C
32 lines
653 B
C
#ifndef __MIDX_H__
|
|
#define __MIDX_H__
|
|
|
|
struct multi_pack_index {
|
|
int fd;
|
|
|
|
const unsigned char *data;
|
|
size_t data_len;
|
|
|
|
uint32_t signature;
|
|
unsigned char version;
|
|
unsigned char hash_len;
|
|
unsigned char num_chunks;
|
|
uint32_t num_packs;
|
|
uint32_t num_objects;
|
|
|
|
const unsigned char *chunk_pack_names;
|
|
const uint32_t *chunk_oid_fanout;
|
|
const unsigned char *chunk_oid_lookup;
|
|
const unsigned char *chunk_object_offsets;
|
|
const unsigned char *chunk_large_offsets;
|
|
|
|
const char **pack_names;
|
|
char object_dir[FLEX_ARRAY];
|
|
};
|
|
|
|
struct multi_pack_index *load_multi_pack_index(const char *object_dir);
|
|
|
|
int write_midx_file(const char *object_dir);
|
|
|
|
#endif
|