All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Karthik Nayak <karthik.188@gmail.com>
Subject: Re: [PATCH 2/3] refs: do not label special refs as pseudo refs
Date: Tue, 30 Apr 2024 14:11:01 +0200	[thread overview]
Message-ID: <ZjDf1TIqTTRMqZ1E@tanuki> (raw)
In-Reply-To: <e9c70778-3414-48ae-8a7d-6b6f0dfaad63@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4721 bytes --]

On Tue, Apr 30, 2024 at 10:59:36AM +0100, Phillip Wood wrote:
> Hi Patrick
> 
> On 30/04/2024 08:30, Patrick Steinhardt wrote:
> > On Mon, Apr 29, 2024 at 04:12:37PM +0100, Phillip Wood wrote:
> > 
> > > This changes the definition to allow pseudorefs to by symbolic refs. When
> > > is_pseudoref() was introduced Junio and I had a brief discussion about this
> > > restriction and he was not in favor of allowing pseudorefs to be symbolic
> > > refs [1].
> > 
> > So the reason why pseudorefs exist is that some refs behave like a ref
> > sometimes, but not always. And in my book that really only applies to
> > MERGE_HEAD and FETCH_HEAD, because those contain additional metadata
> > that makes them not-a-ref. And for those I very much see that they
> > should not ever be a symref.
> > 
> > But everyhing else living in the root of the ref hierarchy is not
> > special in any way, at least not in my opinion. We have never enforced
> > that those cannot be symrefs, and it makes our terminology needlessly
> > confusing.
> 
> I agree HEAD not being a pseudoref and having special refs as well as
> pseudorefs refs is confusing. I do have some sympathy for the argument that
> pseudorefs should not be symbolic refs though as AUTO_MERGE,
> CHERRY_PICK_HEAD, ORIG_HEAD etc. are all pointers to a commit and it would
> be a bug for them to be a symbolic ref. It is unfortunate that in the move
> away from assessing those refs as files we lost the check that they are not
> symbolic refs.

While I agree that conceptually these should always be "regular" refs, I
feel like that is higher-level logic that belongs into the respective
subsystems that write those. I just don't see why the ref backend should
care about the particular usecases that those higher-level subsystems
have, and I can very much see that there might eventually be another
subsystem that actually wants a specific ref to be a symref.

No we could of course start to hard code all kinds of refs into the ref
layer. But I think that this is the wrong way to go, and treating the
ref store as just that, a generic store where you can store refs,
without attaching specific meaning to any of the refs, is the proper way
to go.

> > I think I'm going to reroll this patch series and go down the nuclear
> > path that I've hinted at in the cover letter:
> > 
> >    - Pseudo refs can only be either FETCH_HEAD or MERGE_HEAD.
> > 
> >    - Refs starting with "refs/" are just plain normal refs.
> > 
> >    - Refs living in the root of the ref hierarchy need to conform to a
> >      set of strict rules, as Peff is starting to enforce in a separate
> >      patch series. These are just normal refs, as well, even though we
> >      may call them "root ref" in our tooling as they live in the root of
> >      the ref hierarchy.
> 
> That would certainly be simpler.
> 
> > I just don't think that the current state makes sense to anybody. It's
> > majorly confusing -- I've spent the last 8 months working in our refs
> > code almost exclusively and still forget what's what. How are our users
> > expected to understand this?
> 
> The current state is confusing but arguably there is a logic to the various
> distinctions - whether those distinctions are useful in practice is open to
> debate though. I wonder how much users really care about these distinctions
> and whether it affects their use of git. I was unaware of the distinction
> between HEAD and pseudorefs until I reviewed Karthik's for-each-ref series a
> couple of months ago and I don't think that lack of knowledge had caused me
> any trouble when using git.

There is some logic, that's true enough. I just don't think that anybody
understands the logic.

Patrick

> > > Are there any practical implications of the changes in this patch for users
> > > running commands like "git log FETCH_HEAD" (I can't think of any off the top
> > > of my head but it would be good to have some reassurance on that point in
> > > the commit message)
> > 
> > Not really, no. We have never been doing a good job at enforcing the
> > difference between pseudo refs or normal refs anyway. Pseudo refs can be
> > symrefs just fine, and our tooling won't complain. The only exception
> > where I want us to become stricter is in how we enforce the syntax rules
> > for root refs (which is handled by Peff in a separate patch series), and
> > that we start to not treat FETCH_HEAD and MERGE_HEAD as proper refs.
> > They should still resolve when you ask git-rev-parse(1), but when you
> > iterate through refs they should not be surfaced as they _aren't_ refs.
> 
> That's good
> 
> Thanks
> 
> Phillip
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-04-30 12:11 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 13:41 [PATCH 0/3] Clarify pseudo-ref terminology Patrick Steinhardt
2024-04-29 13:41 ` [PATCH 1/3] refs: move `is_special_ref()` Patrick Steinhardt
2024-04-29 13:41 ` [PATCH 2/3] refs: do not label special refs as pseudo refs Patrick Steinhardt
2024-04-29 15:12   ` Phillip Wood
2024-04-30  7:30     ` Patrick Steinhardt
2024-04-30  9:59       ` Phillip Wood
2024-04-30 12:11         ` Patrick Steinhardt [this message]
2024-04-30 10:23       ` Jeff King
2024-04-30 12:07         ` Karthik Nayak
2024-04-30 12:33           ` Patrick Steinhardt
2024-04-30 12:16         ` Patrick Steinhardt
2024-04-29 16:24   ` Junio C Hamano
2024-04-29 22:52   ` Justin Tobler
2024-04-30  7:29     ` Patrick Steinhardt
2024-05-09 17:29   ` Jean-Noël AVILA
2024-05-10  8:33     ` Patrick Steinhardt
2024-04-29 13:41 ` [PATCH 3/3] refs: fix segfault in `is_pseudoref()` when ref cannot be resolved Patrick Steinhardt
2024-04-29 15:25   ` Phillip Wood
2024-04-29 18:57   ` Karthik Nayak
2024-04-29 19:47     ` Phillip Wood
2024-04-29 20:44       ` Karthik Nayak
2024-04-30  7:30     ` Patrick Steinhardt
2024-04-30 12:26 ` [PATCH v2 00/10] Clarify pseudo-ref terminology Patrick Steinhardt
2024-04-30 12:26   ` [PATCH v2 01/10] Documentation/glossary: redefine pseudorefs as special refs Patrick Steinhardt
2024-04-30 12:49     ` Karthik Nayak
2024-04-30 17:17     ` Justin Tobler
2024-04-30 20:12     ` Junio C Hamano
2024-05-02  8:07       ` Patrick Steinhardt
2024-04-30 12:26   ` [PATCH v2 02/10] Documentation/glossary: clarify limitations of pseudorefs Patrick Steinhardt
2024-04-30 13:35     ` Kristoffer Haugsbakk
2024-04-30 12:26   ` [PATCH v2 03/10] Documentation/glossary: define root refs as refs Patrick Steinhardt
2024-04-30 12:56     ` Karthik Nayak
2024-04-30 12:26   ` [PATCH v2 04/10] refs: rename `is_pseudoref()` to `is_root_ref()` Patrick Steinhardt
2024-04-30 20:20     ` Junio C Hamano
2024-04-30 12:26   ` [PATCH v2 05/10] refs: refname `is_special_ref()` to `is_pseudo_ref()` Patrick Steinhardt
2024-04-30 12:58     ` Karthik Nayak
2024-04-30 12:26   ` [PATCH v2 06/10] refs: classify HEAD as a root ref Patrick Steinhardt
2024-04-30 12:26   ` [PATCH v2 07/10] refs: root refs can be symbolic refs Patrick Steinhardt
2024-04-30 17:09     ` Justin Tobler
2024-05-02  8:07       ` Patrick Steinhardt
2024-05-03 20:49         ` Justin Tobler
2024-05-07 10:32           ` Patrick Steinhardt
2024-04-30 12:26   ` [PATCH v2 08/10] refs: pseudorefs are no refs Patrick Steinhardt
2024-04-30 12:27   ` [PATCH v2 09/10] ref-filter: properly distinuish pseudo and root refs Patrick Steinhardt
2024-04-30 13:11     ` Karthik Nayak
2024-05-02  8:08       ` Patrick Steinhardt
2024-05-02 10:03         ` Karthik Nayak
2024-04-30 12:27   ` [PATCH v2 10/10] refs: refuse to write pseudorefs Patrick Steinhardt
2024-05-02  8:17 ` [PATCH v3 00/10] Clarify pseudo-ref terminology Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 01/10] Documentation/glossary: redefine pseudorefs as special refs Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 02/10] Documentation/glossary: clarify limitations of pseudorefs Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 03/10] Documentation/glossary: define root refs as refs Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 04/10] refs: rename `is_pseudoref()` to `is_root_ref()` Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 05/10] refs: refname `is_special_ref()` to `is_pseudo_ref()` Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 06/10] refs: classify HEAD as a root ref Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 07/10] refs: root refs can be symbolic refs Patrick Steinhardt
2024-05-03 18:13     ` Jeff King
2024-05-15  4:16       ` Patrick Steinhardt
2024-05-15  4:39         ` Patrick Steinhardt
2024-05-15  6:22           ` Jeff King
2024-05-15  6:35             ` Patrick Steinhardt
2024-05-15  6:49               ` Jeff King
2024-05-15  6:59                 ` Patrick Steinhardt
2024-05-15  6:20         ` Jeff King
2024-05-02  8:17   ` [PATCH v3 08/10] refs: pseudorefs are no refs Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 09/10] ref-filter: properly distinuish pseudo and root refs Patrick Steinhardt
2024-05-02  8:17   ` [PATCH v3 10/10] refs: refuse to write pseudorefs Patrick Steinhardt
2024-05-10  8:48 ` [PATCH v4 00/10] Clarify pseudo-ref terminology Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 01/10] Documentation/glossary: redefine pseudorefs as special refs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 02/10] Documentation/glossary: clarify limitations of pseudorefs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 03/10] Documentation/glossary: define root refs as refs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 04/10] refs: rename `is_pseudoref()` to `is_root_ref()` Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 05/10] refs: refname `is_special_ref()` to `is_pseudo_ref()` Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 06/10] refs: root refs can be symbolic refs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 07/10] refs: classify HEAD as a root ref Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 08/10] refs: pseudorefs are no refs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 09/10] ref-filter: properly distinuish pseudo and root refs Patrick Steinhardt
2024-05-10  8:48   ` [PATCH v4 10/10] refs: refuse to write pseudorefs Patrick Steinhardt
2024-05-10 18:59   ` [PATCH v4 00/10] Clarify pseudo-ref terminology Junio C Hamano
2024-05-15  6:50 ` [PATCH v5 " Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 01/10] Documentation/glossary: redefine pseudorefs as special refs Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 02/10] Documentation/glossary: clarify limitations of pseudorefs Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 03/10] Documentation/glossary: define root refs as refs Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 04/10] refs: rename `is_pseudoref()` to `is_root_ref()` Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 05/10] refs: rename `is_special_ref()` to `is_pseudo_ref()` Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 06/10] refs: do not check ref existence in `is_root_ref()` Patrick Steinhardt
2024-05-15 20:38     ` Justin Tobler
2024-05-16  4:13       ` Patrick Steinhardt
2024-05-15  6:50   ` [PATCH v5 07/10] refs: classify HEAD as a root ref Patrick Steinhardt
2024-05-15 20:44     ` Justin Tobler
2024-05-15  6:51   ` [PATCH v5 08/10] refs: pseudorefs are no refs Patrick Steinhardt
2024-05-15  6:51   ` [PATCH v5 09/10] ref-filter: properly distinuish pseudo and root refs Patrick Steinhardt
2024-05-15  6:51   ` [PATCH v5 10/10] refs: refuse to write pseudorefs Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjDf1TIqTTRMqZ1E@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.