Re: [PATCH] HEAD, ORIG_HEAD and FETCH_HEAD are really special.

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] HEAD, ORIG_HEAD and FETCH_HEAD are really special.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:34

Nicolas Pitre [off-list ref] writes:
quoted
It seems to me that instead of introducing an incompatible (but probably
useful) change, a sensible option would be to have the ambiguous
reference be an error instead of a warning. One shouldn't be encouraged
to use names in .git that conflict with stuff in refs/heads anyway.
I agree.  IMHO the sensible thing to do is to always warn, and error out 
by default.  I see no advantage for core.warnAmbiguousRefs=false other 
than allow the user to shoot himself in the foot someday.  Instead, we 
should have core.allowAmbiguousRefs set to off by default.
Well, for about three weeks late November to early December
2005, we did make this an error.  Since mid December 2005, we
reverted that change to the original "take first match, without
even attempting to detect ambiguity".  I do not recall what the
discussion that led to that change was about, but it could have
been the issue Len had that confused "git merge" with a tag and
a branch named after bugzilla bug number.  In any case, this
change most likely was because some people were actually using
the same name and the change to make it an error hurted them.

We then reintroduced the ambiguity detection late March 2006,
but only as a warning, again fearing that erroring out would
break people's existing setups.  I think we also rewrote
examples in our documentation that said "create your own branch
v2.6.13 that fork from v2.6.13 tag" to read "create your own
brancy my-2.6.13..." to avoid encouraging the use of same name
to people.

I think the warning has been with us for a long time and by now
people know better not to confuse themselves.

So I am all for making an ambiguous refname an error in 1.5.4.

At the same time, I think it makes sense to forbid update-ref
outside refs/ if the refname is not special (say, with any
lowercase letters), and ignore names immediately below .git that
are not all-uppercase+underscore (e.g. "FETCH_HEAD" we read,
"description" we ignore).

Please make it so.

Re: [PATCH] HEAD, ORIG_HEAD and FETCH_HEAD are really special.

From: Carl Worth <hidden>
Date: 2016-06-15 22:43:34

On Fri, 07 Sep 2007 13:32:30 -0700, Junio C Hamano wrote:
So I am all for making an ambiguous refname an error in 1.5.4.
If you do, then please also make it an error to create an ambiguous
refname as well.

For example, look at how late the warning comes out in this case, and
how changing it to an error at that point would not help anything:

	$ git branch tmp
	$ ...
	$ git tag tmp	# No warning here!
	$ git show tmp
	warning: refname 'tmp' is ambiguous.

-Carl
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help