Subject: Re: [RFC/PATCH] Re: git submodule -b ... of current HEAD fails

From: Jens Lehmann <[email-masked]>
Date: Wed, 29 Dec 2010 10:04:09 +0100

Am 29.12.2010 01:34, schrieb Junio C Hamano:
> Jens Lehmann <[email-masked]> writes:
>> (But AFAIK the patch doesn't really fix the issue, please see [1] and
>> Jonathan's followup)
>>
>> [1] http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/772659/focus=163242
> 
> I think we queued the later round just uses "checkout -B"; shouldn't that
> work?

That's what I thought too (and that is what I based my ack upon, the
patch hit the right spot and used the - according to the documentation
- better suited -B option). But while writing the test you rightfully
requested I noticed that using -B didn't change much. The reason is
that the following commands both fail in a freshly cloned repo:

$ git checkout -f -q -b master origin/master
fatal: git checkout: branch master already exists
$ git checkout -f -q -B master origin/master
fatal: Cannot force update the current branch.

So maybe the real problem here is that "git checkout -B" barfs when it
doesn't have anything to do instead of silently doing nothing?

So we maybe want to fix this issue in "git checkout"? Then the patch
will start working (and the test for it can be added in a later patch).