Re: [PATCH 07/14] odb: introduce `odb_for_each_object()`
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Jan 16, 2026, 17:46 UTC
- Message-ID
- <aWpz65mPZfy7Hfba@denethor>
- In-Reply-To
- <20260115-pks-odb-for-each-object-v1-7-5418a91d5d99@pks.im>
On 26/01/15 12:04PM, Patrick Steinhardt wrote:
Show 21 quoted lines
> diff --git a/odb.h b/odb.h > index f97f249580..8f6d95aee5 100644 > --- a/odb.h > +++ b/odb.h > @@ -475,6 +475,23 @@ typedef int (*odb_for_each_object_cb)(const struct object_id *oid, > struct object_info *oi, > void *cb_data); > > +/* > + * Iterate through all objects contained in the object database. Note that > + * objects may be iterated over multiple times in case they are either stored > + * in different backends or in case they are stored in multiple sources. > + * > + * Returning a non-zero error code will cause iteration to abort. The error > + * code will be propagated. > + * > + * Returns 0 on success, a negative error code in case a failure occurred, or > + * an arbitrary non-zero error code returned by the callback itself. > + */ > +int odb_for_each_object(struct object_database *odb, > + struct object_info *oi,
Something I probably don't fully understand yet is the role of `struct object_info` being passed in here by `odb_for_each_object()` callers. Outside of configuring the specific object info attributes that are needed for a given callback, is there reason that callers would care about the data that gets populated in it? I was under the impression that this object info was really only needed for the internal `odb_for_eachodbject_cb` that gets invoked.
> + odb_for_each_object_cb cb, > + void *cb_data, > + unsigned flags);