diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-01-25 18:37:18 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-25 18:32:43 -0800 |
commit | 8ef50d9958f7be21e38026433d30f72521b4de47 (patch) | |
tree | b653d9be420dde954169b0af92ebf331ff607deb /pack.h | |
parent | 2f4ba2a867f0390f139b622dbafcab766cb88e80 (diff) | |
download | git-8ef50d9958f7be21e38026433d30f72521b4de47.tar.gz |
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>
Diffstat (limited to 'pack.h')
-rw-r--r-- | pack.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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. |