Subject: Re: git tag -a HEAD leads to ambiguous branch name

From: Junio C Hamano <[email-masked]>
Date: Mon, 02 Dec 2024 13:38:20 +0900

Jeff King <[email-masked]> writes:

> But I don't know about this. I thought when we outlawed "git branch
> HEAD" that it was quite intentional _not_ to forbid these names at the
> lowest level in order to retain backwards compatibility. They are just
> about preventing common UI mistakes.

Yeah, I think this is a sensible way to think about it.

>> There is a dubious test in t5604 that expects you can create such a
>> tag.  t5604.22 wants to create one:
>> 
>> test_expect_success 'clone with reference from a tagged repository' '
>> 	(
>> 		cd A && git tag -a -m tagged HEAD
>> 	) &&
>> 	git clone --reference=A A I
>> '
>> 
>> and t5604.24 wants to use it.
>
> Weird. Comes from 09116a1c31 (refs: loosen over-strict "format" check,
> 2011-11-16). I don't see any reason it could not just be "foo".

Hmph, yeah, reverting the code change of 09116a1c31 and then using
'foo' instead of 'HEAD' fails the test exactly the same way.