threads / discuss / 40014

fetching from an hg remote fails with bare git repositories

Subject: fetching from an hg remote fails with bare git repositories

## tl;dr

5 messages between Aug 4, 2015 and Aug 6, 2015.

replies: 4people: 3as markdown or json

Taylor Braun-Jones· Aug 4, 2015, 17:45 UTC · lore

Fetching from an hg remote fails with bare git repositories. Non-bare repositories work fine.

Steps to reproduce:

mkdir /tmp/hgrepo cd /tmp/hgrepo hg init echo foo > foo.txt hg add foo.txt hg commit -m "add foo.txt" foo.txt git clone hg::/tmp/hgrepo/ /tmp/gitrepo cd /tmp/gitrepo/ git fetch # WORKS git clone --bare hg::/tmp/hgrepo/ /tmp/gitrepo.git cd /tmp/gitrepo.git/ git fetch # FAILS

The error message from the last line is:

fatal: bad object 0000000000000000000000000000000000000000 error: hg::/tmp/hgrepo/ did not send all necessary objects

Taylor
Stefan Beller· Aug 4, 2015, 18:56 UTC · re: Taylor Braun-Jones · lore

Re: fetching from an hg remote fails with bare git repositories

On Tue, Aug 4, 2015 at 10:45 AM, Taylor Braun-Jones <taylor@braun-jones.org> wrote:

Show 24 quoted lines
> Fetching from an hg remote fails with bare git repositories. Non-bare
> repositories work fine.
>
> Steps to reproduce:
>
> mkdir /tmp/hgrepo
> cd /tmp/hgrepo
> hg init
> echo foo > foo.txt
> hg add foo.txt
> hg commit -m "add foo.txt" foo.txt
> git clone hg::/tmp/hgrepo/ /tmp/gitrepo
> cd /tmp/gitrepo/
> git fetch # WORKS
> git clone --bare hg::/tmp/hgrepo/ /tmp/gitrepo.git
> cd /tmp/gitrepo.git/
> git fetch # FAILS
>
> The error message from the last line is:
>
> fatal: bad object 0000000000000000000000000000000000000000
> error: hg::/tmp/hgrepo/ did not send all necessary objects
>
> Taylor

Which version of git did you test this with? Does it also happen on the latest version?

> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Taylor Braun-Jones· Aug 4, 2015, 21:27 UTC · re: Stefan Beller · lore

Re: fetching from an hg remote fails with bare git repositories

On Tue, Aug 4, 2015 at 2:56 PM, Stefan Beller <sbeller@google.com> wrote:
Show 29 quoted lines
> On Tue, Aug 4, 2015 at 10:45 AM, Taylor Braun-Jones
> <taylor@braun-jones.org> wrote:
>> Fetching from an hg remote fails with bare git repositories. Non-bare
>> repositories work fine.
>>
>> Steps to reproduce:
>>
>> mkdir /tmp/hgrepo
>> cd /tmp/hgrepo
>> hg init
>> echo foo > foo.txt
>> hg add foo.txt
>> hg commit -m "add foo.txt" foo.txt
>> git clone hg::/tmp/hgrepo/ /tmp/gitrepo
>> cd /tmp/gitrepo/
>> git fetch # WORKS
>> git clone --bare hg::/tmp/hgrepo/ /tmp/gitrepo.git
>> cd /tmp/gitrepo.git/
>> git fetch # FAILS
>>
>> The error message from the last line is:
>>
>> fatal: bad object 0000000000000000000000000000000000000000
>> error: hg::/tmp/hgrepo/ did not send all necessary objects
>>
>> Taylor
>
> Which version of git did you test this with? Does it also happen on
> the latest version?

Sorry - forgot that detail. This is using git 2.1.4 from Ubuntu 15.04 x86_64. I haven't tried the latest version of git yet.

Mike Hommey· Aug 4, 2015, 23:03 UTC · re: Taylor Braun-Jones · lore

Re: fetching from an hg remote fails with bare git repositories

On Tue, Aug 04, 2015 at 05:27:13PM -0400, Taylor Braun-Jones wrote:
Show 33 quoted lines
> On Tue, Aug 4, 2015 at 2:56 PM, Stefan Beller <sbeller@google.com> wrote:
> > On Tue, Aug 4, 2015 at 10:45 AM, Taylor Braun-Jones
> > <taylor@braun-jones.org> wrote:
> >> Fetching from an hg remote fails with bare git repositories. Non-bare
> >> repositories work fine.
> >>
> >> Steps to reproduce:
> >>
> >> mkdir /tmp/hgrepo
> >> cd /tmp/hgrepo
> >> hg init
> >> echo foo > foo.txt
> >> hg add foo.txt
> >> hg commit -m "add foo.txt" foo.txt
> >> git clone hg::/tmp/hgrepo/ /tmp/gitrepo
> >> cd /tmp/gitrepo/
> >> git fetch # WORKS
> >> git clone --bare hg::/tmp/hgrepo/ /tmp/gitrepo.git
> >> cd /tmp/gitrepo.git/
> >> git fetch # FAILS
> >>
> >> The error message from the last line is:
> >>
> >> fatal: bad object 0000000000000000000000000000000000000000
> >> error: hg::/tmp/hgrepo/ did not send all necessary objects
> >>
> >> Taylor
> >
> > Which version of git did you test this with? Does it also happen on
> > the latest version?
> 
> Sorry - forgot that detail. This is using git 2.1.4 from Ubuntu 15.04
> x86_64. I haven't tried the latest version of git yet.

Another missing detail is what you're using for mercurial support in git. I would guess https://github.com/felipec/git-remote-hg. Shameless plug, you may want to give a try to https://github.com/glandium/git-cinnabar.

Anyways, your error looks like what I fixed in 33cae54, which git describe tells me made it to git 2.3.2.

Mike
Taylor Braun-Jones· Aug 6, 2015, 18:21 UTC · re: Mike Hommey · lore

Re: fetching from an hg remote fails with bare git repositories

On Tue, Aug 4, 2015 at 7:03 PM, Mike Hommey <mh@glandium.org> wrote:
> Another missing detail is what you're using for mercurial support in
> git. I would guess https://github.com/felipec/git-remote-hg.

Yes. I was going off some outdated information on the web that told me the felipec/git-remote-hg had moved to mainline git. I now see that has been undone.

> Shameless plug, you may want to give a try to
> https://github.com/glandium/git-cinnabar.

Thanks, I'll keep an eye on the project for support for pushing merge commits. That missing feature is a show-stopper for me right now. Since git-cinnabar is not doing a full hg clone under the hood, is there a chance that it will support shallow clones? (even before the native hg client has this feature...)

> Anyways, your error looks like what I fixed in 33cae54, which git
> describe tells me made it to git 2.3.2.

Yep, grabbing the latest version of git (2.5.0) solved the problem. Sorry for the bother.

Taylor

← back to recent threads