Re: [PATCH 6/8] check_refname_format(): add FULLY_QUALIFIED flag
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 30, 2024, 17:00 UTC
- Message-ID
- <xmqqmspardk5.fsf@gitster.g>
- In-Reply-To
- <ZjDDa5PIxPCFzMhq@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 5 quoted lines
>> valid. E.g., validating a refspec may involve a name like "main" on its >> own. I suspect it would be OK in practice to just give it an arbitrary >> "refs/foo/$main", but that feels kind of hacky. > > Ah, fair enough.
I actually do not think it is fair enough. Why does the caller want to validate "main" in the first place? To make the example more realistic, lets imagine a caller wants to validate "HEAD". We can say "it is syntactically correct", but in what context is that answer useful? If the caller is contemplating to create a new branch given a short-name, we would want to say "no, refs/heads/HEAD is not something we want you to create", but if the caller is planning to create refs/remotes/origin/HEAD, our answer would be different.