The following commits will incrementally move code specific to writing MIDXs from midx.c to their new home in midx-write.c. Prepare for that by externing a pair of functions which: - will (temporarily) need to be called from both midx.c and midx-write.c, but - are implementation details that should not be exposed via the midx.h header. Declare these functions as extern within midx-write.c, and introduce a similar (non-extern) declaration within midx.c. This change will be effectively reverted by the end of this series. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- midx-write.c | 10 ++++++++++ midx.c | 24 +++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/midx-write.c b/midx-write.c index 214179d308..4aab273243 100644 --- a/midx-write.c +++ b/midx-write.c @@ -1,2 +1,12 @@ #include "git-compat-util.h" #include "midx.h" + +extern int write_midx_internal(const char *object_dir, + struct string_list *packs_to_include, + struct string_list *packs_to_drop, + const char *preferred_pack_name, + const char *refs_snapshot, + unsigned flags); + +extern struct multi_pack_index *lookup_multi_pack_index(struct repository *r, + const char *object_dir); diff --git a/midx.c b/midx.c index 85e1c2cd12..5f22f01716 100644 --- a/midx.c +++ b/midx.c @@ -23,6 +23,16 @@ #include "list-objects.h" #include "pack-revindex.h" +struct multi_pack_index *lookup_multi_pack_index(struct repository *r, + const char *object_dir); + +int write_midx_internal(const char *object_dir, + struct string_list *packs_to_include, + struct string_list *packs_to_drop, + const char *preferred_pack_name, + const char *refs_snapshot, + unsigned flags); + #define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */ #define MIDX_VERSION 1 #define MIDX_BYTE_FILE_VERSION 4 @@ -1347,7 +1357,7 @@ static int write_midx_bitmap(const char *midx_name, return ret; } -static struct multi_pack_index *lookup_multi_pack_index(struct repository *r, +struct multi_pack_index *lookup_multi_pack_index(struct repository *r, const char *object_dir) { struct multi_pack_index *result = NULL; @@ -1372,12 +1382,12 @@ static struct multi_pack_index *lookup_multi_pack_index(struct repository *r, return result; } -static int write_midx_internal(const char *object_dir, - struct string_list *packs_to_include, - struct string_list *packs_to_drop, - const char *preferred_pack_name, - const char *refs_snapshot, - unsigned flags) +int write_midx_internal(const char *object_dir, + struct string_list *packs_to_include, + struct string_list *packs_to_drop, + const char *preferred_pack_name, + const char *refs_snapshot, + unsigned flags) { struct strbuf midx_name = STRBUF_INIT; unsigned char midx_hash[GIT_MAX_RAWSZ]; -- 2.44.0.290.g736be63234b