summaryrefslogtreecommitdiff
path: root/builtin/cat-file.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 /builtin/cat-file.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 'builtin/cat-file.c')
-rw-r--r--builtin/cat-file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index ee6715fa52..0ab076aeb3 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -852,10 +852,9 @@ static void batch_each_object(struct batch_options *opt,
if (bitmap && !for_each_bitmapped_object(bitmap, &opt->objects_filter,
batch_one_object_bitmapped, &payload)) {
- struct packfile_store *packs = the_repository->objects->packfiles;
struct packed_git *pack;
- for (pack = packfile_store_get_all_packs(packs); pack; pack = pack->next) {
+ repo_for_each_pack(the_repository, pack) {
if (bitmap_index_contains_pack(bitmap, pack) ||
open_pack_index(pack))
continue;