Subject: Re: BUG or FEATURE? Use of '/' in branch names

From: Michael Haggerty <[email-masked]>
Date: Sun, 04 May 2014 07:39:48 +0200

On 05/03/2014 09:35 AM, Dennis Kaarsemaker wrote:
> On vr, 2014-05-02 at 15:16 -0700, Jonathan Nieder wrote:
>>>     $ git checkout -b hotfix/b2
>>>     error: unable to resolve reference refs/heads/hotfix/b2: Not a
>> directory
>>>     fatal: Failed to lock ref for update: Not a directory
>>>     $
>>
>> That's an ugly message.  I think we can do better. (hint hint)
> 
> 2.0.0-rc2 has a better message already:
> 
> $ git checkout -b hotfix/b2
> error: 'refs/heads/hotfix' exists; cannot create 'refs/heads/hotfix/b2'
> fatal: Failed to lock ref for update: Not a directory

I was trying to remember when this was changed, but at first I couldn't
reproduce the "fixed" error message at all.  Finally I figured out that
the the error message that you get depends on whether the existing
reference is loose:

    $ bin-wrappers/git checkout -b master/foo
    error: unable to resolve reference refs/heads/master/foo: Not a
directory
    fatal: Failed to lock ref for update: Not a directory

vs. packed:

    $ bin-wrappers/git checkout -b base/foo
    error: 'refs/heads/base' exists; cannot create 'refs/heads/base/foo'
    fatal: Failed to lock ref for update: Not a directory

It would be good to make the error message uniform and to document this
restriction.

Michael

-- 
Michael Haggerty
[email-masked]
http://softwareswirl.blogspot.com/