]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: only prepare owning store in `packfile_store_get_packs()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 18 Dec 2025 06:55:25 +0000 (07:55 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2026 00:37:43 +0000 (09:37 +0900)
When calling `packfile_store_get_packs()` we prepare not only the
provided packfile store, but also all those of all other sources part of
the same object database. This was required when the store was still
sitting on the object database level. But now that it sits on the source
level it's not anymore.

Adapt the code so that we only prepare the MIDX of the provided store.
All callers only work in the context of a single store or call the
function in a loop over all sources, so this change shouldn't have any
practical effects.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
packfile.c

index a0225cb2cb5ea2c9836094a9f5d2852cfa1c63cc..c46d53b75dbea77209149cc65ad200c434a912c8 100644 (file)
@@ -1092,10 +1092,8 @@ struct packfile_list_entry *packfile_store_get_packs(struct packfile_store *stor
 {
        packfile_store_prepare(store);
 
-       for (struct odb_source *source = store->source->odb->sources; source; source = source->next) {
-               struct multi_pack_index *m = source->midx;
-               if (!m)
-                       continue;
+       if (store->source->midx) {
+               struct multi_pack_index *m = store->source->midx;
                for (uint32_t i = 0; i < m->num_packs + m->num_packs_in_base; i++)
                        prepare_midx_pack(m, i);
        }