← Back to team overview

dulwich-users team mailing list archive

Re: Pushing to bitbucket via https generates SendPackError: unpack eof before pack header was fully read

 

OK. forget that error. That was some of my debug printing causing the read
data to not be chunked properly via the read() calls. Instead of getting 4
bytes it got all of them. Reverted the dulwich code and the push (without
the HEAD ref) completes correctly.

Thanks for your help and pointers.

Regards

Crispin


On Wed, Oct 16, 2013 at 2:11 PM, Crispin Wellington <crispinw@xxxxxxxxxx>wrote:

> On Wed, Oct 16, 2013 at 11:36 AM, Jelmer Vernooij <jelmer@xxxxxxxxx>wrote:
>
>> What version of dulwich are you using? There were some fixes for pushes
>>  in 0.9.1.
>>
>
> Yes. 0.9.1.
>
>
>> It looks like HEAD in the remote repo is a symref to refs/heads/master.
>> I think it's telling you that if you update one to a particular ref, you
>> should
>> update the other to that particular ref too.
>
>
> Ok, so I got past this error by not returning 'HEAD' in the 'want'
> callback dictionary. Thus it doesn't try to set the HEAD reference on the
> remote (presumably bare) repo.
>
> The push code now looks like:
>
>         client = HttpsGitClient(url, ...)
>         parse = urlparse(url)
>
>         def wantrefs(oldrefs):
>             v = self.repo.get_refs().copy()
>             del v['HEAD']
>             return v
>
>         client.send_pack(parse.path,
>                          wantrefs,
>                          self.repo.object_store.generate_pack_contents)
>
> Now when I push the repository I get past the point I was stuck at. The
> push succeeds and the remote repo ref is updated (pulling the repo fresh
> gets me the latest dulwich commit and the head ref is pointing at it).
> But now it produces this error:
>
> Traceback (most recent call last):
>   File "repository.py", line 263, in <module>
>     r.push(url, username="cwellington", password=sys.argv[1])
>   File "/.../repository.py", line 87, in push
>     self.repo.object_store.generate_pack_contents)
>   File "/.../python2.7/site-packages/dulwich/client.py", line 931, in
> send_pack
>     progress)
>   File "/.../python2.7/site-packages/dulwich/client.py", line 339, in
> _handle_receive_pack_tail
>     self._read_side_band64k_data(proto, channel_callbacks)
>   File "/.../python2.7/site-packages/dulwich/client.py", line 283, in
> _read_side_band64k_data
>     for pkt in proto.read_pkt_seq():
>   File "/.../python2.7/site-packages/dulwich/protocol.py", line 147, in
> read_pkt_seq
>     pkt = self.read_pkt_line()
>   File "/.../python2.7/site-packages/dulwich/protocol.py", line 104, in
> read_pkt_line
>     size = int(sizestr, 16)
> ValueError: invalid literal for int() with base 16: '0030\x01000eunpack
> ok\n0019ok refs/heads/master\n00000000'
>
> This doesn't look normal...
>
> Crispin
>

References