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

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 9 Oct 2025 08:03:57 +0200

On Wed, Oct 08, 2025 at 11:52:26PM +0800, shejialuo wrote:
> 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.

I don't really have a strong reason to be honest, I think both "target"
and "referent" would be fine.

Patrick