mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
packfile: introduce macro to iterate through packs
We have a bunch of different sites that want to iterate through all packs of a given `struct packfile_store`. This pattern is somewhat verbose and repetitive, which makes it somewhat cumbersome. Introduce a new macro `repo_for_each_pack()` that removes some of the boilerplate. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
5b410c8276
commit
86d8c62f48
@@ -213,9 +213,11 @@ static void find_short_packed_object(struct disambiguate_state *ds)
|
||||
unique_in_midx(m, ds);
|
||||
}
|
||||
|
||||
for (p = packfile_store_get_all_packs(ds->repo->objects->packfiles); p && !ds->ambiguous;
|
||||
p = p->next)
|
||||
repo_for_each_pack(ds->repo, p) {
|
||||
if (ds->ambiguous)
|
||||
break;
|
||||
unique_in_pack(p, ds);
|
||||
}
|
||||
}
|
||||
|
||||
static int finish_object_disambiguation(struct disambiguate_state *ds,
|
||||
@@ -805,7 +807,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)
|
||||
find_abbrev_len_for_midx(m, mad);
|
||||
}
|
||||
|
||||
for (p = packfile_store_get_all_packs(mad->repo->objects->packfiles); p; p = p->next)
|
||||
repo_for_each_pack(mad->repo, p)
|
||||
find_abbrev_len_for_pack(p, mad);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user