[PATCH 6/8] packfile: stop using linked MIDX list in `find_pack_entry()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 9, 2025, 07:54 UTC
- Message-ID
- <20250709-b4-pks-midx-via-odb-alternate-v1-6-f31150d21331@pks.im>
- In-Reply-To
- <20250709-b4-pks-midx-via-odb-alternate-v1-0-f31150d21331@pks.im>
Refactor `find_pack_entry()` so that we stop using the linked list of multi-pack indices. Note that there is no need to explicitly prepare alternates, and neither do we have to use `get_multi_pack_index()`, because `prepare_packed_git()` already takes care of populating all data structures for us.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- packfile.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/packfile.c b/packfile.c index e1ced050451..776a72678f5 100644 --- a/packfile.c +++ b/packfile.c @@ -2073,16 +2073,15 @@ static int fill_pack_entry(const struct object_id *oid, int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e) { struct list_head *pos; - struct multi_pack_index *m; prepare_packed_git(r); - if (!r->objects->packed_git && !r->objects->multi_pack_index) - return 0; - for (m = r->objects->multi_pack_index; m; m = m->next) { - if (fill_midx_entry(r, oid, e, m)) + for (struct odb_source *source = r->objects->sources; source; source = source->next) + if (source->multi_pack_index && fill_midx_entry(r, oid, e, source->multi_pack_index)) return 1; - } + + if (!r->objects->packed_git) + return 0; list_for_each(pos, &r->objects->packed_git_mru) { struct packed_git *p = list_entry(pos, struct packed_git, mru);
-- 2.50.1.327.g047016eb4a.dirty