Skip to content

Commit c620586

Browse files
pks-tgitster
authored andcommitted
packfile: stop using linked MIDX list in get_all_packs()
Refactor `get_all_packs()` 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7fc1998 commit c620586

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packfile.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,12 +1086,13 @@ struct multi_pack_index *get_multi_pack_index(struct odb_source *source)
10861086

10871087
struct packed_git *get_all_packs(struct repository *r)
10881088
{
1089-
struct multi_pack_index *m;
1090-
10911089
prepare_packed_git(r);
1092-
for (m = r->objects->multi_pack_index; m; m = m->next) {
1093-
uint32_t i;
1094-
for (i = 0; i < m->num_packs + m->num_packs_in_base; i++)
1090+
1091+
for (struct odb_source *source = r->objects->sources; source; source = source->next) {
1092+
struct multi_pack_index *m = source->midx;
1093+
if (!m)
1094+
continue;
1095+
for (uint32_t i = 0; i < m->num_packs + m->num_packs_in_base; i++)
10951096
prepare_midx_pack(r, m, i);
10961097
}
10971098

0 commit comments

Comments
 (0)