Re: BUG or FEATURE? Use of '/' in branch names
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 mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG or FEATURE? Use of '/' in branch names
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 -- Dennis Kaarsemaker www.kaarsemaker.net -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG or FEATURE? Use of '/' in branch names
Hi, Keith Derrick wrote: > Yes, I've since found some discussion on this, and had already changed > to use '-' to append the classifier. > > But the other problem is that I can't easily find this restriction > documented anywhere - which means it comes as a suprise to people. That sounds like another serious bug (the first one was the lousy error message). The current behavior is intended, and it sounds like the documentation is lagging. Where did you expect to find information about this? Knowing that would help a lot in fixing it. (The nicest way to indicate where you expected to read about this is with a patch against the relevant file in Documentation/*.txt, of course.) Thanks again, Jonathan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG or FEATURE? Use of '/' in branch names
Yes, I've since found some discussion on this, and had already changed to use '-' to append the classifier. But the other problem is that I can't easily find this restriction documented anywhere - which means it comes as a suprise to people. As it stands, the documentation implies that what I tried should work. In which case, how it's been *implemented* seems to be breaking the promise of the functional specification (if you view the documentation as such). Keith On 05/02/2014 03:16 PM, Jonathan Nieder wrote: > Hi Keith, > > Keith Derrick wrote: > >> $ git checkout -b hotfix >> Switched to a new branch 'hotfix' >> $ 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) > > Longer term, I think people would like to make it possible for a > 'hotfix' and 'hotfix/b2' branch to coexist, but that will take some > work, and until then, git tries to be careful about enforcing the > constraint that they cannot coexist. > > Fixing it would be complicated by the need to avoid breaking people > with older versions of git when they fetch from you (what happens to > the origin/hotfix and origin/hotfix/b2 remote-tracking refs on the > client side?). > > Thanks and hope that helps, > Jonathan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: BUG or FEATURE? Use of '/' in branch names
Keith Derrick wrote: > I can see the value in grouping branches in a directory tree under > refs/heads, but wouldn't it make more sense to simply escape the '/' > in the branch name so that 'hotfix/b1' is stored on disk as > 'hotfix\/b1'? This would be nice for remote helpers: Mercurial can have "hotfix" and "hotifx/b1", so importing such a Mercurial repository creates problems. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG or FEATURE? Use of '/' in branch names
Hi Keith, Keith Derrick wrote: > $ git checkout -b hotfix > Switched to a new branch 'hotfix' > $ 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) Longer term, I think people would like to make it possible for a 'hotfix' and 'hotfix/b2' branch to coexist, but that will take some work, and until then, git tries to be careful about enforcing the constraint that they cannot coexist. Fixing it would be complicated by the need to avoid breaking people with older versions of git when they fetch from you (what happens to the origin/hotfix and origin/hotfix/b2 remote-tracking refs on the client side?). Thanks and hope that helps, Jonathan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG or FEATURE? Use of '/' in branch names
Keith Derrick writes: > The problem arises when a branch already exists with a name > matching the stem of the new branch name. > ... > But, for the reverse reason, I can't now create the branch named 'hotfix' All correct. Allowing '/' in branch names came about not with a careful design but was done by a happy accident, and we accepted it under the condition "as long as users know that they cannot have branches D and D/F at the same time, that is fine". An obvious alternative convention you can adopt would be to use not '/' but some other separating characters (e.g. "_") as your hierarchy delimiter, if you must have D and D_F at the same time. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html