Subject: Re: [PATCH 07/14] odb: introduce `odb_for_each_object()`

From: Justin Tobler <[email-masked]>
Date: Fri, 16 Jan 2026 11:46:12 -0600

On 26/01/15 12:04PM, Patrick Steinhardt wrote:
> 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);