Re: [PATCH 01/13] refs: introduce wrapper struct for `each_ref_fn`
- From
shejialuo <shejialuo@gmail.com>
- Date
- Oct 8, 2025, 15:52 UTC
- Message-ID
- <aOaIuji6EDFi-Yg5@ArchLinux>
- In-Reply-To
- <20251007-b4-pks-ref-filter-skip-parsing-objects-v1-1-916cc7c6886b@pks.im>
On Tue, Oct 07, 2025 at 12:58:38PM +0200, Patrick Steinhardt wrote:
Show 16 quoted lines
> diff --git a/refs.h b/refs.h
> index 4e6bd63aa86..2b24a3d9974 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -355,14 +355,32 @@ struct ref_transaction;
> */
> #define REF_BAD_NAME 0x08
>
> +/* A reference passed to `for_each_ref()`-style callbacks. */
> +struct reference {
> + /* The fully-qualified name of the reference. */
> + const char *name;
> +
> + /* The target of a symbolic ref. `NULL` for direct references. */
> + const char *target;
> +I have a question here, why do we name this `target` instead of `referent`? Oh, I somehow know your motivation as we already create a structure `struct reference`, it is redudant that we use `referent` as the name.
Show 11 quoted lines
> + /* > + * The object ID of a reference. Either the direct object ID or the > + * resolved object ID in the case of a symbolic ref. May be the zero > + * object ID in case the symbolic ref cannot be resolved. > + */ > + const struct object_id *oid; > + > + /* A bitfield of `REF_` flags. */ > + int flags; > +}; > +
Thanks, Jialuo