git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Patrick Steinhardt" <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: What’s the intended/reasonable usage patterns for symrefs?
Date: Wed, 16 Oct 2024 19:23:12 +0200	[thread overview]
Message-ID: <7347e29a-f33e-472b-b993-06c4767a9456@app.fastmail.com> (raw)
In-Reply-To: <Zwzvgby2_oCjQpii@pks.im>

On Mon, Oct 14, 2024, at 12:16, Patrick Steinhardt wrote:
> On Sun, Oct 13, 2024 at 09:57:23PM +0200, Kristoffer Haugsbakk wrote:
>> […]
>> This seems overly restrictive for this day and age though? No?
>
> There at least is no technical reason to restrict this from the ref
> backend's point of view. Neither the "files" nor the "reftable" backend
> enforce any restrictions except the restrictions we have in place for
> any other reference: a ref is either a root ref, a pseudoref or it must
> start with "refs/".
>
> Now the only reason why I'd say that you maybe shouldn't create weird
> symrefs is that tooling isn't prepared to handle them. But that is not
> sufficient reason for me to say that you mustn't create them.

Thanks.  This makes sense. :)

❦

I discovered/re-discovered a pitfall with the following approach:

> Create a `refs/heads/<symref>` which points to a remote-tracking
> branch

Again, so tempting to do for me because you get a shorthand via
`refs/heads`.  And this is indeed fine for read-only operations
(effectively).

But don’t be careless and do something like commit while checked out
here.  Because you are checked out on an ostensibly “proper branch” (not
detached HEAD) and the remote-tracking branch will move forward with a
commit.

So I’ve gone back to using one-level (root-level) symrefs with
all-capital names.  Because git-symbolic-ref(1) allows that and I
haven’t gotten any weird warnings from it.  (I would presumably get
warnings if I then defined a ref named e.g. `refs/heads/M` if `M` was my
top-level symref.)

  reply	other threads:[~2024-10-16 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 19:57 What’s the intended/reasonable usage patterns for symrefs? Kristoffer Haugsbakk
2024-10-14 10:16 ` Patrick Steinhardt
2024-10-16 17:23   ` Kristoffer Haugsbakk [this message]
2024-11-04 10:45     ` Kristoffer Haugsbakk
2025-06-20 15:29       ` Kristoffer Haugsbakk

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=7347e29a-f33e-472b-b993-06c4767a9456@app.fastmail.com \
    --to=kristofferhaugsbakk@fastmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).