Re: "git symbolic-ref" doesn't do a very good job
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Aug 1, 2022, 17:49 UTC
- Message-ID
- <CAHk-=wg8EaHnM_OcHrw=+sT3VPAkTUpzeaQ8EjTDLUENK58HSw@mail.gmail.com>
- In-Reply-To
- <YugPER9UsH1z6MZo@coredump.intra.peff.net>
)(
On Mon, Aug 1, 2022 at 10:36 AM Jeff King <peff@peff.net> wrote:
Show 5 quoted lines
> > No, sadly, that isn't the rule. See afe5d3d516 (symbolic ref: refuse > non-ref targets in HEAD, 2009-01-29) which tightened it to "refs/heads" > and then e9cc02f0e4 (symbolic-ref: allow refs/<whatever> in HEAD, > 2009-02-13) which had to loosen it.
But it seems that at least this issue won't affect check_refname_format().
Hmm. Looking at that again - even without ALLOW_ONELEVEL I don't actually think check_refname_format() requires "refs/" per se. So the HEAD check isn't actually made redundant.
I wonder what the intended semantic meaning of ALLOW_ONELEVEL really is supposed to be. It seems to really only require *one* slash - but it doesn't really end up checking that it's in the "refs/" hierarchy, it can be anywhere.
I guess the only thing it disallows is literally HEAD and MERGE_HEAD and the like. But it's a bit odd, because it would seem to possibly allow you to use "refs" that point to the objects/ directory or similar.
Maybe the refs/ protection comes in somewhere later, I didn't really go around to check.
Linus