Skip to content

Commit 7fc1998

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

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packfile.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,16 +2074,15 @@ static int fill_pack_entry(const struct object_id *oid,
20742074
int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e)
20752075
{
20762076
struct list_head *pos;
2077-
struct multi_pack_index *m;
20782077

20792078
prepare_packed_git(r);
2080-
if (!r->objects->packed_git && !r->objects->multi_pack_index)
2081-
return 0;
20822079

2083-
for (m = r->objects->multi_pack_index; m; m = m->next) {
2084-
if (fill_midx_entry(r, oid, e, m))
2080+
for (struct odb_source *source = r->objects->sources; source; source = source->next)
2081+
if (source->midx && fill_midx_entry(r, oid, e, source->midx))
20852082
return 1;
2086-
}
2083+
2084+
if (!r->objects->packed_git)
2085+
return 0;
20872086

20882087
list_for_each(pos, &r->objects->packed_git_mru) {
20892088
struct packed_git *p = list_entry(pos, struct packed_git, mru);

0 commit comments

Comments
 (0)