git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Faye-Lund <kusmabite@gmail.com>
To: Stephen Kelly <steveire@gmail.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	git@vger.kernel.org
Subject: Re: Creating remote branch called HEAD corrupts remote clones
Date: Mon, 2 May 2011 21:43:05 +0200	[thread overview]
Message-ID: <BANLkTinJvt=Nnt8YG-D1wpWKbBei+m+4XA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinqxy6jCJLNVPKmMW3CErbfN7Hm=g@mail.gmail.com>

On Mon, May 2, 2011 at 9:26 PM, Stephen Kelly <steveire@gmail.com> wrote:
> On Wed, Apr 27, 2011 at 2:49 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> 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.
>

No, it's still an issue, and I believe I pin-pointed it in my first
mail. You can try out the patch I sent, and see if that helps in your
case. If it does, I think it'd make sense to do something (preferably
a bit more robust) with it.

  reply	other threads:[~2011-05-02 19:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 10:02 Creating remote branch called HEAD corrupts remote clones Stephen Kelly
2011-01-20 11:14 ` Stephen Kelly
2011-01-20 13:03   ` Thomas Rast
2011-01-20 15:05     ` Stephen Kelly
2011-01-20 15:41       ` Erik Faye-Lund
2011-01-20 16:00         ` Stephen Kelly
2011-01-20 17:32   ` Felipe Contreras
2011-01-20 19:21     ` Wesley J. Landaker
2011-01-20 19:53 ` Junio C Hamano
2011-01-20 20:38   ` Jeff King
2011-01-20 21:43     ` Junio C Hamano
2011-01-20 21:54       ` Jeff King
2011-01-20 23:52         ` Felipe Contreras
2011-01-21 17:37           ` Junio C Hamano
2011-01-22 12:46             ` Felipe Contreras
2011-02-20 13:17               ` Stephen Kelly
2011-04-26 12:09                 ` Stephen Kelly
2011-04-26 18:18                   ` Felipe Contreras
2011-04-27  9:18                     ` Stephen Kelly
2011-04-27  9:48                       ` Felipe Contreras
2011-04-27 11:29                         ` Stephen Kelly
2011-04-27 11:32                           ` Felipe Contreras
2011-04-27 11:37                             ` Stephen Kelly
2011-04-27 12:26                               ` Felipe Contreras
2011-04-27 12:21                           ` Erik Faye-Lund
2011-04-27 12:49                             ` Erik Faye-Lund
2011-05-02 19:26                               ` Stephen Kelly
2011-05-02 19:43                                 ` Erik Faye-Lund [this message]
2011-05-03 17:54                                   ` Felipe Contreras
2011-05-03 18:08                                     ` Stephen Kelly
2011-05-03 19:20                                       ` Felipe Contreras
2011-05-04 12:35                                     ` Erik Faye-Lund
2011-05-09  7:51                                       ` [PATCH] only warn about ambiguous refs if stderr is a tty Erik Faye-Lund
2011-05-09  8:03                                         ` Jeff King
2011-05-09  8:41                                           ` Erik Faye-Lund
2011-05-09 10:32                                             ` Jeff King
2011-05-09 12:37                                               ` Erik Faye-Lund
2011-05-09 12:49                                                 ` Jeff King
2011-05-09 16:33                                                   ` Junio C Hamano
2011-05-09 22:09                                                     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTinJvt=Nnt8YG-D1wpWKbBei+m+4XA@mail.gmail.com' \
    --to=kusmabite@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=steveire@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).