From a587b5a7869e9a399d4de6edea0b3f32a3548639 Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Tue, 30 Mar 2021 11:04:29 -0400 Subject: pack-write.c: extract 'write_rev_file_order' Existing callers provide the reverse index code with an array of 'struct pack_idx_entry *'s, which is then sorted by pack order (comparing the offsets of each object within the pack). Prepare for the multi-pack index to write a .rev file by providing a way to write the reverse index without an array of pack_idx_entry (which the MIDX code does not have). Instead, callers can invoke 'write_rev_index_positions()', which takes an array of uint32_t's. The ith entry in this array specifies the ith object's (in index order) position within the pack (in pack order). Expose this new function for use in a later patch, and rewrite the existing write_rev_file() in terms of this new function. Signed-off-by: Taylor Blau Signed-off-by: Junio C Hamano --- pack.h | 1 + 1 file changed, 1 insertion(+) (limited to 'pack.h') diff --git a/pack.h b/pack.h index afdcf8f5c7..09c2a7dd3a 100644 --- a/pack.h +++ b/pack.h @@ -94,6 +94,7 @@ 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); +const char *write_rev_file_order(const char *rev_name, uint32_t *pack_order, uint32_t nr_objects, const unsigned char *hash, unsigned flags); /* * The "hdr" output buffer should be at least this big, which will handle sizes -- cgit v1.3