mirror of
https://github.com/git/git.git
synced 2024-06-10 14:36:48 +02:00
The multi-pack-index needs to track which packfiles it indexes. Store these in our first required chunk. Since filenames are not well structured, add padding to keep good alignment in later chunks. Modify the 'git multi-pack-index read' subcommand to output the existence of the pack-file name chunk. Modify t5319-multi-pack-index.sh to reflect this new output and the new expected number of chunks. Defense in depth: A pattern we are using in the multi-pack-index feature is to verify the data as we write it. We want to ensure we never write invalid data to the multi-pack-index. There are many checks that verify that the values we are writing fit the format definitions. This mainly helps developers while working on the feature, but it can also identify issues that only appear when dealing with very large data sets. These large sets are hard to encode into test cases. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
27 lines
465 B
C
27 lines
465 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;
|
|
|
|
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
|