From: Patrick Steinhardt Date: Thu, 05 Mar 2026 13:30:54 GMT Subject: Re: [PATCH 11/17] odb/source: make `for_each_object()` function pluggable Message-ID: In-Reply-To: On Thu, Mar 05, 2026 at 01:07:15PM +0000, Karthik Nayak wrote: > [snip] > > > diff --git a/odb/source.h b/odb/source.h > > index edb425fdef..35aa78e140 100644 > > --- a/odb/source.h > > +++ b/odb/source.h > > @@ -151,6 +163,27 @@ struct odb_source { > > int (*read_object_stream)(struct odb_read_stream **out, > > struct odb_source *source, > > const struct object_id *oid); > > + > > + /* > > + * This callback is expected to iterate over all objects stored in this > > This isn't a callback though, this is a function which calls the > callback, right? No, this is the callback function in the `struct odb_source`. That callback in turn ends up invoking another callback though :) > > + * source and invoke the callback function for each of them. It is > > + * valid to yield the same object multiple time. A non-zero exit code > > + * from the object callback shall abort iteration. > > + * > > + * The optional `oi` structure shall be populated similar to how an individual > > + * call to `odb_source_read_object_info()` would have behaved. If the caller > > + * passes a `NULL` pointer then the object itself shall not be read. > > + * > > Nit: here and below, we talk about the `oi` structure, but that's in the > callback function, maybe we should clarify that. Ah, this is still somewhat stale from an earlier iteration where `oi` and `request` were the same thing, and `request` was non-const. Will fix. Patrick