summaryrefslogtreecommitdiff
path: root/builtin/count-objects.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/count-objects.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/count-objects.c')
-rw-r--r--builtin/count-objects.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index f2f407c2a7..18f6e33b6f 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -122,7 +122,6 @@ int cmd_count_objects(int argc,
count_loose, count_cruft, NULL, NULL);
if (verbose) {
- struct packfile_store *packs = the_repository->objects->packfiles;
struct packed_git *p;
unsigned long num_pack = 0;
off_t size_pack = 0;
@@ -130,7 +129,7 @@ int cmd_count_objects(int argc,
struct strbuf pack_buf = STRBUF_INIT;
struct strbuf garbage_buf = STRBUF_INIT;
- for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
+ repo_for_each_pack(the_repository, p) {
if (!p->pack_local)
continue;
if (open_pack_index(p))