Subject: Re: [PATCH 01/13] refs: introduce wrapper struct for `each_ref_fn`

From: shejialuo <[email-masked]>
Date: Wed, 8 Oct 2025 23:52:26 +0800

On Tue, Oct 07, 2025 at 12:58:38PM +0200, Patrick Steinhardt wrote:
> 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.

> +	/*
> +	 * 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