mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
pack-write.c: prepare to write 'pack-*.rev' files
This patch prepares for callers to be able to write reverse index files to disk. It adds the necessary machinery to write a format-compliant .rev file from within 'write_rev_file()', which is called from 'finish_tmp_packfile()'. Similar to the process by which the reverse index is computed in memory, these new paths also have to sort a list of objects by their offsets within a packfile. These new paths use a qsort() (as opposed to a radix sort), since our specialized radix sort requires a full revindex_entry struct per object, which is more memory than we need to allocate. The qsort is obviously slower, but the theoretical slowdown would require a repository with a large amount of objects, likely implying that the time spent in, say, pack-objects during a repack would dominate the overall runtime. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2f4ba2a867
commit
8ef50d9958
4
pack.h
4
pack.h
@@ -42,6 +42,8 @@ struct pack_idx_option {
|
||||
/* flag bits */
|
||||
#define WRITE_IDX_VERIFY 01 /* verify only, do not write the idx file */
|
||||
#define WRITE_IDX_STRICT 02
|
||||
#define WRITE_REV 04
|
||||
#define WRITE_REV_VERIFY 010
|
||||
|
||||
uint32_t version;
|
||||
uint32_t off32_limit;
|
||||
@@ -91,6 +93,8 @@ struct ref;
|
||||
|
||||
void write_promisor_file(const char *promisor_name, struct ref **sought, int nr_sought);
|
||||
|
||||
const char *write_rev_file(const char *rev_name, struct pack_idx_entry **objects, uint32_t nr_objects, const unsigned char *hash, unsigned flags);
|
||||
|
||||
/*
|
||||
* The "hdr" output buffer should be at least this big, which will handle sizes
|
||||
* up to 2^67.
|
||||
|
||||
Reference in New Issue
Block a user