summaryrefslogtreecommitdiff
path: root/t/helper/test-find-pack.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-10-09 10:01:39 +0200
committerJunio C Hamano <gitster@pobox.com>2025-10-16 14:42:39 -0700
commit86d8c62f48a1b193299de19c4dbc664650a853f1 (patch)
tree298065976ca8ffaf25137cabedf391d5b0a835d0 /t/helper/test-find-pack.c
parent5b410c82768c025814af17e23cea3b7f253f111d (diff)
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>
Diffstat (limited to 't/helper/test-find-pack.c')
-rw-r--r--t/helper/test-find-pack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/helper/test-find-pack.c b/t/helper/test-find-pack.c
index e001dc3066..fc4b8a77b3 100644
--- a/t/helper/test-find-pack.c
+++ b/t/helper/test-find-pack.c
@@ -39,11 +39,12 @@ int cmd__find_pack(int argc, const char **argv)
if (repo_get_oid(the_repository, argv[0], &oid))
die("cannot parse %s as an object name", argv[0]);
- for (p = packfile_store_get_all_packs(the_repository->objects->packfiles); p; p = p->next)
+ repo_for_each_pack(the_repository, p) {
if (find_pack_entry_one(&oid, p)) {
printf("%s\n", p->pack_name);
actual_count++;
}
+ }
if (count > -1 && count != actual_count)
die("bad packfile count %d instead of %d", actual_count, count);