# fetching from an hg remote fails with bare git repositories

5 messages from 2015-08-04 to 2015-08-06. Participants: Taylor Braun-Jones, Stefan Beller, Mike Hommey.
Thread: https://gitlist.dev/t/40014

## Taylor Braun-Jones, 2015-08-04 17:45

Subject: fetching from an hg remote fails with bare git repositories
Message-ID: <CAKfKJYuuO+eak-L2SUVUEmoOj16bgV6LL0S=g-LzFjTxZUcRzQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAKfKJYuuO%2Beak-L2SUVUEmoOj16bgV6LL0S%3Dg-LzFjTxZUcRzQ%40mail.gmail.com

```
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, 2015-08-04 18:56

Subject: Re: fetching from an hg remote fails with bare git repositories
Message-ID: <CAGZ79kawh0himmR+DuvcQB0O1rRVBhkg9ycCLvPdbp1m0sHKtQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kawh0himmR%2BDuvcQB0O1rRVBhkg9ycCLvPdbp1m0sHKtQ%40mail.gmail.com
In-Reply-To: <CAKfKJYuuO+eak-L2SUVUEmoOj16bgV6LL0S=g-LzFjTxZUcRzQ@mail.gmail.com>

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

> --
> 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, 2015-08-04 21:27

Subject: Re: fetching from an hg remote fails with bare git repositories
Message-ID: <CAKfKJYshy58eQMXTusUTf0dc2B7uVU+=rzdSicSG0JAuODSBug@mail.gmail.com>
URL: https://gitlist.dev/e/CAKfKJYshy58eQMXTusUTf0dc2B7uVU%2B%3DrzdSicSG0JAuODSBug%40mail.gmail.com
In-Reply-To: <CAGZ79kawh0himmR+DuvcQB0O1rRVBhkg9ycCLvPdbp1m0sHKtQ@mail.gmail.com>

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

```

## Mike Hommey, 2015-08-04 23:03

Subject: Re: fetching from an hg remote fails with bare git repositories
Message-ID: <20150804230359.GA27965@glandium.org>
URL: https://gitlist.dev/e/20150804230359.GA27965%40glandium.org
In-Reply-To: <CAKfKJYshy58eQMXTusUTf0dc2B7uVU+=rzdSicSG0JAuODSBug@mail.gmail.com>

```
On Tue, Aug 04, 2015 at 05:27:13PM -0400, Taylor Braun-Jones wrote:
> 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, 2015-08-06 18:21

Subject: Re: fetching from an hg remote fails with bare git repositories
Message-ID: <CAKfKJYtujyEBH4JhTyt=PzZbpB-iYhi=h5FbjAM2j9cuDGh1Hw@mail.gmail.com>
URL: https://gitlist.dev/e/CAKfKJYtujyEBH4JhTyt%3DPzZbpB-iYhi%3Dh5FbjAM2j9cuDGh1Hw%40mail.gmail.com
In-Reply-To: <20150804230359.GA27965@glandium.org>

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

```
