* Bug in git 2.1.0 when cloning to directory with same name as repository
@ 2014-09-23 7:49 Chris Salzberg
2014-09-23 8:39 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Chris Salzberg @ 2014-09-23 7:49 UTC (permalink / raw)
To: git
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.:
> git clone github:nixme/pry-nav "github:nixme/pry-nav"
Cloning into 'github:nixme/pry-nav'...
done.
ror: internal error: refs/remotes/origin/master is not a valid
packed reference!
error: internal error: refs/tags/v0.0.1 is not a valid packed reference!
error: internal error: refs/tags/v0.0.2 is not a valid packed reference!
error: internal error: refs/tags/v0.0.3 is not a valid packed reference!
error: internal error: refs/tags/v0.0.4 is not a valid packed reference!
error: internal error: refs/tags/v0.1.0 is not a valid packed reference!
error: internal error: refs/tags/v0.2.0 is not a valid packed reference!
error: internal error: refs/tags/v0.2.1 is not a valid packed reference!
error: internal error: refs/tags/v0.2.2 is not a valid packed reference!
error: internal error: refs/tags/v0.2.3 is not a valid packed reference!
error: internal error: refs/tags/v0.2.4 is not a valid packed reference!
error: Trying to write ref refs/heads/master with nonexistent object
f0e17451f0bd508f408d4fdda97e3a131d11f696
fatal: Cannot update the ref 'HEAD'
The ssh config for github (not that it matters, but for completeness) is:
Host github
user git
hostname github.com
I have confirmed that if the repository url does not have a dash, this
works as expected. I have also downgraded to 2.0.4 and found that
again, this works as expected. Beyond this I have not narrowed the
scope.
For now, I've downgraded my version of git and so have not tested beyond this.
Chris Salzberg
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug in git 2.1.0 when cloning to directory with same name as repository
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
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2014-09-23 8:39 UTC (permalink / raw)
To: Chris Salzberg; +Cc: Michael Barabanov, git
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-23 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).