git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2007, 20:32 UTC
Message-ID
<7vejha43oh.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.0.9999.0709071222270.21186@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 9 quoted lines
>> 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.
Previous: Nicolas PitreNext: Carl Worth
Message 15 of 17 in “rebase from ambiguous ref discards changes”
  1. Keith PackardSep 6, 2007
  2. Pierre HabouzitSep 6, 2007
  3. Junio C HamanoSep 6, 2007
  4. Keith PackardSep 7, 2007
  5. Pierre HabouzitSep 7, 2007
  6. HEAD, ORIG_HEAD and FETCH_HEAD are really special.Junio C Hamano, Sep 7, 2007
  7. Johannes SixtSep 7, 2007
  8. Pierre HabouzitSep 7, 2007
  9. Junio C HamanoSep 7, 2007
  10. Pierre HabouzitSep 7, 2007
  11. Alex RiesenSep 8, 2007
  12. Keith PackardSep 7, 2007
  13. Keith PackardSep 7, 2007
  14. Nicolas PitreSep 7, 2007
  15. Junio C HamanoSep 7, 2007
  16. Carl WorthSep 7, 2007
  17. Junio C HamanoSep 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.