diff options
Diffstat (limited to 'builtin/gc.c')
-rw-r--r-- | builtin/gc.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index c19545d49e..d9fbbd711e 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -125,26 +125,26 @@ static int too_many_loose_objects(void) return needed; } +static int count_packs(struct packed_git *p, void *data) +{ + /* + * Perhaps check the size of the pack and count only + * very small ones here? + */ + if (p->pack_local && !p->pack_keep) + (*((int *) data))++; + return 0; +} + static int too_many_packs(void) { - struct packed_git *p; - int cnt; + int cnt = 0; if (gc_auto_pack_limit <= 0) return 0; prepare_packed_git(); - for (cnt = 0, p = packed_git; p; p = p->next) { - if (!p->pack_local) - continue; - if (p->pack_keep) - continue; - /* - * Perhaps check the size of the pack and count only - * very small ones here? - */ - cnt++; - } + foreach_packed_git(count_packs, NULL, &cnt); return gc_auto_pack_limit <= cnt; } |