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

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

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
May 4, 2014, 05:39 UTC
Message-ID
<5365D2A4.9010702@alum.mit.edu>
In-Reply-To
<1399102525.2716.1.camel@spirit>
On 05/03/2014 09:35 AM, Dennis Kaarsemaker wrote:
Show 14 quoted lines
> 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
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Dennis Kaarsemaker
Message 8 of 8 in “BUG or FEATURE? Use of '/' in branch names”
  1. Keith DerrickMay 2, 2014
  2. Felipe ContrerasMay 2, 2014
  3. Junio C HamanoMay 2, 2014
  4. Jonathan NiederMay 2, 2014
  5. Keith DerrickMay 2, 2014
  6. Jonathan NiederMay 2, 2014
  7. Dennis KaarsemakerMay 3, 2014
  8. Michael HaggertyMay 4, 2014

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.