From: Jeff King <peff@peff.net>
To: Chris Salzberg <csalzberg@degica.com>
Cc: Michael Barabanov <michael.barabanov@windriver.com>, git@vger.kernel.org
Subject: Re: Bug in git 2.1.0 when cloning to directory with same name as repository
Date: Tue, 23 Sep 2014 04:39:03 -0400 [thread overview]
Message-ID: <20140923083903.GA7644@peff.net> (raw)
In-Reply-To: <CAMoD=Bi41mB3QRn3JdZL-FGHs4w3C2jGpnJB-CqSndO7FMtfzA@mail.gmail.com>
On Tue, Sep 23, 2014 at 04:49:55PM +0900, Chris Salzberg wrote:
> I've found what looks like a bug wherein if you are using an ssh alias
> for a git remote, and that remote has a dash in its name, and you
> specify the target path as the name of the url itself, git complains
> about refs not being valid packed references.
>
> To reproduce, in git 2.1.0 and with a repository using ssh config and
> which has a dash in the name, e.g.:
Thanks for a reproduction recipe. I think we can make it simpler,
though. The problem seems to come when your destination directory is
identical to the remote URL. I saw similar failures with:
git clone git@github.com:git/git git@github.com:git/git
and even:
git clone https://github.com/git/git https://github.com/git/git
It bisects to f38aa83 (use local cloning if insteadOf makes a local URL,
2014-07-17) by Michael Barabanov (cc'd). That commit moved a call to
get_repo_path() much further down cmd_clone, after we have already
created the repo directory. As a result, we try to fetch objects from
the newly created directory, which of course has none (and because it's
local, we try to use "cp" instead of the git protocol. We don't notice
the error at transfer time, but rather later when trying to write out
the references).
I'm not sure of the simplest solution. I guess along the lines of one
of:
1. Move the code back before the directory is created. Rather than
using `remote_get` to apply insteadOf substitution as a side
effect, make it possible to call into the insteadOf code directly.
2. It might work to chdir() into the repo after creating it, though
that probably creates its own problems with other relative paths
(and I am not sure it would save us if you had a remote URL that
looked like an absolute path).
-Peff
prev parent reply other threads:[~2014-09-23 8:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 7:49 Bug in git 2.1.0 when cloning to directory with same name as repository Chris Salzberg
2014-09-23 8:39 ` Jeff King [this message]
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=20140923083903.GA7644@peff.net \
--to=peff@peff.net \
--cc=csalzberg@degica.com \
--cc=git@vger.kernel.org \
--cc=michael.barabanov@windriver.com \
/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).