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

Re: Creating remote branch called HEAD corrupts remote clones

From
SKStephen Kelly <steveire@gmail.com>
Date
May 2, 2011, 19:26 UTC
Message-ID
<BANLkTinqxy6jCJLNVPKmMW3CErbfN7Hm=g@mail.gmail.com>
In-Reply-To
<BANLkTikxS-_9h4rBdbbJ2e-RkjMWyiC1Mg@mail.gmail.com>
On Wed, Apr 27, 2011 at 2:49 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 52 quoted lines
> On Wed, Apr 27, 2011 at 2:21 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Wed, Apr 27, 2011 at 1:29 PM, Stephen Kelly <steveire@gmail.com> wrote:
>>> On Wed, Apr 27, 2011 at 11:48 AM, Felipe Contreras
>>> <felipe.contreras@gmail.com> wrote:
>>>> No problems here:
>>>
>>> I had another go.
>>>
>>> mkdir remote
>>> cd remote/
>>> git init --bare
>>> cd ../
>>> git clone remote/ alice
>>> cd alice/
>>> echo test >> file
>>> git add file
>>> git commit -am w
>>> git push origin master
>>> echo test >> file
>>> git commit -am w
>>> git branch HEAD
>>
>> I'll stop you here. You reproduce the issue a lot simpler:
>>
>> git init foo &&
>> cd foo &&
>> echo "foo" > bar &&
>> git add bar &&
>> git commit -m. &&
>> git branch HEAD &&
>> gitk
>>
>> No need to involve remote branches. While remote branches makes the
>> issue worse, because you can get in a situation where gitk doesn't
>> when someone else made a nasty branch, and you fetched it.
>>
>> The real problem is that "git rev-parse HEAD" outputs "warning:
>> refname 'HEAD' is ambiguous." to stderr (even if stderr is a non-tty),
>> and gitk does not like that.
>>
>> This can be fixed by either doing "git -c core.warnambiguousrefs=0
>> rev-parse HEAD", which strikes me as ugly, or by making sure that we
>> don't issue this warning when not attached to a tty:
>
> Of course, a third (and probably even better) option is to make gitk
> warn about the ambiguous refname (like other commands will), but not
> treat it as a fatal problem. But I'm not motivated enough to give that
> solution a stab myself.
>
> Not outputting that warning might be a regression for other users of
> rev-parse (and/or the underlying mechanics).
>

Ok, if you can't see in the code why a branch called HEAD might corrupt the remote and I can't demonstrate it with a testcase, maybe it's not an issue anymore, I don't know.

Hopefully the relevant people saw the side issues brought up such as this ambiguous ref issue. After all, there's no other way to track those issues.

Thanks for the investigation and help,
Steve.
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 27 of 40 in “Creating remote branch called HEAD corrupts remote clones”
  1. Stephen KellyJan 17, 2011
  2. Stephen KellyJan 20, 2011
  3. Thomas RastJan 20, 2011
  4. Stephen KellyJan 20, 2011
  5. Erik Faye-LundJan 20, 2011
  6. Stephen KellyJan 20, 2011
  7. Felipe ContrerasJan 20, 2011
  8. Wesley J. LandakerJan 20, 2011
  9. Junio C HamanoJan 20, 2011
  10. Jeff KingJan 20, 2011
  11. Junio C HamanoJan 20, 2011
  12. Jeff KingJan 20, 2011
  13. Felipe ContrerasJan 20, 2011
  14. Junio C HamanoJan 21, 2011
  15. Felipe ContrerasJan 22, 2011
  16. Stephen KellyFeb 20, 2011
  17. Stephen KellyApr 26, 2011
  18. Felipe ContrerasApr 26, 2011
  19. Stephen KellyApr 27, 2011
  20. Felipe ContrerasApr 27, 2011
  21. Stephen KellyApr 27, 2011
  22. Felipe ContrerasApr 27, 2011
  23. Stephen KellyApr 27, 2011
  24. Felipe ContrerasApr 27, 2011
  25. Erik Faye-LundApr 27, 2011
  26. Erik Faye-LundApr 27, 2011
  27. Stephen KellyMay 2, 2011
  28. Erik Faye-LundMay 2, 2011
  29. Felipe ContrerasMay 3, 2011
  30. Stephen KellyMay 3, 2011
  31. Felipe ContrerasMay 3, 2011
  32. Erik Faye-LundMay 4, 2011
  33. only warn about ambiguous refs if stderr is a ttyErik Faye-Lund, May 9, 2011
  34. Jeff KingMay 9, 2011
  35. Erik Faye-LundMay 9, 2011
  36. Jeff KingMay 9, 2011
  37. Erik Faye-LundMay 9, 2011
  38. Jeff KingMay 9, 2011
  39. Junio C HamanoMay 9, 2011
  40. Jeff KingMay 9, 2011

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.