From: Jeff King <peff@peff.net>
To: Philip Oakley <philipoakley@iee.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Félix Saparelli" <felix@passcod.name>,
git@vger.kernel.org
Subject: Re: [Non-Bug] cloning a repository with a default MASTER branch tries to check out the master branch
Date: Wed, 24 May 2017 10:19:48 -0400 [thread overview]
Message-ID: <20170524141947.2gguzcvyu6lch373@sigill.intra.peff.net> (raw)
In-Reply-To: <76BD8B6A1511438B8CCB79C616F3BC5B@PhilipOakley>
On Wed, May 24, 2017 at 12:24:52AM +0100, Philip Oakley wrote:
> > > $ git clone git@github.com:passcod/UPPERCASE-NPM.git
> > > Cloning into 'UPPERCASE-NPM'...
> > > remote: Counting objects: 14, done.
> > > remote: Compressing objects: 100% (11/11), done.
> > > remote: Total 14 (delta 3), reused 14 (delta 3), pack-reused 0
> > > Receiving objects: 100% (14/14), done.
> > > Resolving deltas: 100% (3/3), done.
> > > warning: remote HEAD refers to nonexistent ref, unable to checkout.
>
> Perhaps here the warning message could include the value of the ref provided
> by the remote's HEAD which would then more clearly indicate to the user what
> was expected.
>
> I haven't had chance to look at how easy that maybe in the code - perhaps a
> bit of low hanging fruit for someone?
Unfortunately, it can't, because the ref doesn't exist:
$ git ls-remote git://github.com/passcod/UPPERCASE-NPM.git
efc7dbfd6ca155d5d19ce67eb98603896062f35a refs/heads/MASTER
e60ea8e6ec45ec45ff44ac8939cb4105b16477da refs/pull/1/head
f35a73dcb151d336dc3d30c9a2c7423ecdb7bd1c refs/pull/2/head
0d9b3a1268ff39350e04a7183af0add912b686e6 refs/tags/V1.0.0
efc7dbfd6ca155d5d19ce67eb98603896062f35a refs/tags/V1.0.1
There is no HEAD line at all, so we have no information about it on the
client side. Likewise, if you run with GIT_TRACE_PACKET=1, you'll see
that the capabilities line does not include a symref marker either.
So if we wanted to improve this, I think the first step would be for the
server to start sending symref lines for HEAD, even when it does not
resolve to anything.
That would also make a case like this:
git -C dst.git symbolic-ref refs/heads/does-not-exist
git clone dst.git local
use "does-not-exist" as the default branch name in our local clone
(rather than just falling back to "master", which presumably the other
side never plans to use).
-Peff
next prev parent reply other threads:[~2017-05-24 14:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 21:42 [Bug] cloning a repository with a default MASTER branch tries to check out the master branch Félix Saparelli
2017-05-23 3:40 ` [Non-Bug] " Junio C Hamano
2017-05-23 23:24 ` Philip Oakley
2017-05-24 14:19 ` Jeff King [this message]
2017-05-25 1:36 ` Junio C Hamano
2017-05-25 3:13 ` Junio C Hamano
2017-05-25 15:59 ` Jeff King
2017-05-25 19:11 ` Jeff King
2017-05-25 23:28 ` Junio C Hamano
2017-05-26 20:00 ` Philip Oakley
2017-05-26 21:17 ` Philip Oakley
2017-05-27 23:55 ` Junio C Hamano
2017-05-28 11:21 ` Philip Oakley
2017-05-28 12:57 ` Junio C Hamano
2017-05-31 4:43 ` Jeff King
2017-05-23 8:01 ` [Bug] " Samuel Lijin
2017-05-23 12:12 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170524141947.2gguzcvyu6lch373@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=felix@passcod.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=philipoakley@iee.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).