From: Patrick Steinhardt Date: Fri, 16 Jan 2026 07:03:38 GMT Subject: Re: [PATCH 07/14] odb: introduce `odb_for_each_object()` Message-ID: In-Reply-To: On Thu, Jan 15, 2026 at 03:17:07PM -0600, Justin Tobler wrote: > On 26/01/15 12:04PM, Patrick Steinhardt wrote: > > diff --git a/odb.c b/odb.c > > index ac70b6a099..65f0447aa5 100644 > > --- a/odb.c > > +++ b/odb.c > > @@ -995,6 +995,33 @@ int odb_freshen_object(struct object_database *odb, > > return 0; > > } > > > > +int odb_for_each_object(struct object_database *odb, > > + struct object_info *oi, > > + odb_for_each_object_cb cb, > > + void *cb_data, > > + unsigned flags) > > +{ > > + int ret; > > + > > + odb_prepare_alternates(odb); > > + for (struct odb_source *source = odb->sources; source; source = source->next) { > > + if (flags & ODB_FOR_EACH_OBJECT_LOCAL_ONLY && !source->local) > > + continue; > > + > > + if (!(flags & ODB_FOR_EACH_OBJECT_PROMISOR_ONLY)) { > > + ret = odb_source_loose_for_each_object(source, oi, cb, cb_data, flags); > > + if (ret) > > + return ret; > > + } > > + > > + ret = packfile_store_for_each_object(source->packfiles, oi, cb, cb_data, flags); > > + if (ret) > > + return ret; > > + } > > + > > + return 0; > > +} > > Ok, I think I understand a bit more clearly now. As implemented here, > odb_for_each_object() iterates across each the objects (loose and > packed) in each source. Object iteration is not handled transparently > for each source yet though and we still explicitly iterate both loose > and packed objects. If I understand correctly, this current > implementation will become specific to the "files" backend/source in the > future. Yup, that's correct :) Patrick