From: Patrick Steinhardt Date: Tue, 09 Jun 2026 07:27:29 GMT Subject: Re: [PATCH 11/16] odb/source-packed: wire up `count_objects()` callback Message-ID: In-Reply-To: On Mon, Jun 08, 2026 at 09:12:06AM -0700, Karthik Nayak wrote: > Patrick Steinhardt writes: > > [snip] > > > diff --git a/odb/source-packed.c b/odb/source-packed.c > > index a61c809c8c..013d8a50f8 100644 > > --- a/odb/source-packed.c > > +++ b/odb/source-packed.c > > @@ -338,6 +338,39 @@ static int odb_source_packed_for_each_object(struct odb_source *source, > > return ret; > > } > > > > +static int odb_source_packed_count_objects(struct odb_source *source, > > + enum odb_count_objects_flags flags UNUSED, > > + unsigned long *out) > > +{ > > + struct odb_source_packed *packed = odb_source_packed_downcast(source); > > + struct packfile_list_entry *e; > > + struct multi_pack_index *m; > > + unsigned long count = 0; > > + int ret; > > + > > + m = get_multi_pack_index(&packed->files->base); > > + if (m) > > + count += m->num_objects + m->num_objects_in_base; > > + > > + for (e = packfile_store_get_packs(packed); e; e = e->next) { > > + if (e->pack->multi_pack_index) > > + continue; > > + if (open_pack_index(e->pack)) { > > + ret = -1; > > + goto out; > > + } > > + > > + count += e->pack->num_objects; > > + } > > + > > + *out = count; > > + ret = 0; > > + > > +out: > > + return ret; > > +} > > + > > + > > Nit: extra newline. Good catch, fixed locally. Patrick