packfile: move get_multi_pack_index() into "midx.c"

The `get_multi_pack_index()` function is declared and implemented in the
packfile subsystem, even though it really belongs into the multi-pack
index subsystem. The reason for this is likely that it needs to call
`packfile_store_prepare()`, which is not exposed by the packfile system.
In a subsequent commit we're about to add another caller outside of the
packfile system though, so we'll have to expose the function anyway.

Do so now already and move `get_multi_pack_index()` into the MIDX
subsystem.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-09-23 12:17:11 +02:00
committed by Junio C Hamano
parent d67530f6bb
commit ab8aff4a6b
4 changed files with 17 additions and 8 deletions

View File

@@ -1003,7 +1003,7 @@ static void packfile_store_prepare_mru(struct packfile_store *store)
list_add_tail(&p->mru, &store->mru);
}
static void packfile_store_prepare(struct packfile_store *store)
void packfile_store_prepare(struct packfile_store *store)
{
struct odb_source *source;
@@ -1033,12 +1033,6 @@ struct packed_git *get_packed_git(struct repository *r)
return r->objects->packfiles->packs;
}
struct multi_pack_index *get_multi_pack_index(struct odb_source *source)
{
packfile_store_prepare(source->odb->packfiles);
return source->midx;
}
struct packed_git *get_all_packs(struct repository *r)
{
packfile_store_prepare(r->objects->packfiles);