From: Jeff King <peff@peff.net>
To: Alain Kalker <a.c.kalker@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] Git clone of a bundle fails, but works (somewhat) when run with strace
Date: Fri, 15 Feb 2013 23:01:09 -0500 [thread overview]
Message-ID: <20130216040109.GA31630@sigill.intra.peff.net> (raw)
In-Reply-To: <kfmide$4ro$3@ger.gmane.org>
On Sat, Feb 16, 2013 at 12:03:58AM +0000, Alain Kalker wrote:
> ---test.sh---
> #!/bin/sh
>
> make clean
> make || return 125
> GIT=$(pwd)/git
>
> cd /tmp
> rm -rf testrepo
> mkdir testrepo
> cd testrepo
> $GIT init
> echo test > test.txt
> $GIT add test.txt
> $GIT commit -m "Add test.txt"
> $GIT bundle create ../testrepo.bundle master || return 125
> cd ..
>
> rm -rf testrepofrombundle
> $GIT clone testrepo.bundle testrepofrombundle || return 1
> ---
> I was unable to find a bad revision.
> After a lot more searching I found that I had `git` aliased to `hub`, a
> tool used to make Github actions easier.
> Eliminating `hub` from the equation resolved most problems.
Great.
> The only ones remaining are the confusing error message from `git bundle
> create` and the "missing HEAD" (you can interpret that in different
> ways) ;-)
I do not see any odd message from "bundle create" in the recipe above.
Mine says:
$ git bundle create ../repo.bundle master
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
What you _might_ be seeing is the fact that the invocation above is
likely to be running two different versions of git under the hood. "git
bundle" will invoke "git rev-list", and it will use the first git in
your PATH, even if it is not $GIT. The proper way to test an un-installed
version of git is to use $YOUR_GIT_BUILD/bin-wrappers/git, which will
set up environment variables sufficient to make sure all sub-gits are
from the same version. Sometimes mixing versions can have weird results
(e.g., the new "git bundle" expects "rev-list" to have a particular
option, but the older version does not have it).
Secondly, I do get the same warning about HEAD:
$ git clone repo.bundle repofrombundle
Cloning into 'repofrombundle'...
Receiving objects: 100% (3/3), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
but that warning makes sense. You did not create a bundle that contains
HEAD, therefore when we clone it, we do not know what to point HEAD to.
You probably wanted "git bundle create ../repo.bundle --all" which
includes both "master" and "HEAD".
It would be slightly more accurate to say "the remote HEAD does not
exist", rather than "refers to nonexistent ref". It would perhaps be
nicer still for "git clone" to make a guess about the correct HEAD when
one is not present (especially in the single-branch case, it is easy to
make the right guess).
Patches welcome. In the meantime, you can clone with "-b master" to tell
it explicitly, or you can "git checkout master" inside the newly-cloned
repository.
-Peff
next prev parent reply other threads:[~2013-02-16 4:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 19:33 [BUG] Git clone of a bundle fails, but works (somewhat) when run with strace Alain Kalker
2013-02-15 22:25 ` Alain Kalker
2013-02-16 0:03 ` Alain Kalker
2013-02-16 0:09 ` Junio C Hamano
2013-02-16 4:01 ` Jeff King [this message]
2013-02-17 13:01 ` Alain Kalker
2013-02-17 18:04 ` Philip Oakley
2013-02-25 6:59 ` Junio C Hamano
2014-05-28 15:59 ` Bram Geron
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=20130216040109.GA31630@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=a.c.kalker@gmail.com \
--cc=git@vger.kernel.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).