Re: [BUG] Git clone of a bundle fails, but works (somewhat) when run with strace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 15 Feb 2013 23:01:09 -0500, Jeff King wrote:

> 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).

Thanks for the very useful tip! I will try to remember to use this for 
any future testing.

> 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".

That explains it, thanks! Maybe this could be added as an example to the 
documentation for `git bundle`? People looking at `man git-bundle` hoping 
to use it as one possible way to make a backup of a Git repository might 
not realize right away that --all is the way to specify all refs, like 
with `git log`.

> 
> 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.

Thanks again for your help, very welcome :-)

Alain

--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]