On Wed, Feb 18, 2015 at 3:24 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > If you did this: > > $ git init void && > git -C void commit --allow-empty -m initial && > git -C void symbolic-ref HEAD refs/heads/nosuch > $ git clone --no-local void new > > you would get > > warning: remote HEAD refers to nonexistent ref, unable to checkout. I think there is another problem. $ git status On branch master Initial commit which makes no sense. So after playing around I found: $ git init void && git -C void commit --allow-empty -m initial && touch void/asdf git -C void add asdf git -C void commit -a -m "add a file" git -C void symbolic-ref HEAD refs/heads/nosuch git clone --no-local void new This yields the warning as above and git status still tells us we're on master. Though ls new shows an empty directory/repository. After a `git checkout master` we can see the file and all is good to go. How did we know we are on the master branch in the first place? (and not on foo/bar, HEAD is pointing at nonsense!) So what is the `current branch` of your new error message referring to? Why did git status claim to be on branch master, but the repository state was not in masters state, but in the unborn state? These questions asked, would it make sense to either add a git checkout `current branch` at the end of clone? (I suppose that is what HEAD is good for actually). Also it would make sense to have it's own HEAD pointing to 0{40} or equivalent (just nothing) instead of having the master branch available. > > While it is correct that we are unable to perform the normal > "checkout" of their primary branch that their HEAD points at, > it was reported that some users find this message unnecessarily > alarming. > > Rephrase by saying what we decided to do, instead of only stating > what led us to that decision without telling what that decision is. > That is, "(because we cannot checkout), we left the HEAD pointing at > an unborn branch." > > --- > builtin/clone.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/builtin/clone.c b/builtin/clone.c > index 9572467..c7f1bf2 100644 > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -625,8 +625,8 @@ static int checkout(void) > > head = resolve_refdup("HEAD", RESOLVE_REF_READING, sha1, NULL); > if (!head) { > - warning(_("remote HEAD refers to nonexistent ref, " > - "unable to checkout.\n")); > + warning(_("remote HEAD refers to nonexistent ref; " > + "leaving the current branch unborn.\n")); Personally I find that more confusing, because I have an idea of what checkout may refer to. The notion of an unborn branch is not clear to me. Maybe > - warning(_("remote HEAD refers to nonexistent ref, " > - "unable to checkout.\n")); > + warning(_("remote HEAD refers to nonexistent ref; " > + "Checking out $branch instead.\n")); with $branch being master in the example above. I'd have no idea how to come up with a good heuristic which branch to checkout. (It would need to match current behavior) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html