Skip to content

Instantly share code, notes, and snippets.

@jchu
Created October 2, 2012 21:21
Show Gist options
  • Save jchu/3823386 to your computer and use it in GitHub Desktop.
Save jchu/3823386 to your computer and use it in GitHub Desktop.
client fetch errors when remote repo is empty
from dulwich.client import get_transport_and_path
from dulwich.repo import Repo
# some local repo
local = Repo('/tmp/local')
# /tmp/remote.git is an empty bare repo
client, remote_path = get_transport_and_path('milki@localhost:/tmp/remote.git')
remote_refs = client.fetch(remote_path, local)
####### output #######
Traceback (most recent call last):
File "client.py", line 12, in <module>
remote_refs = client.fetch(remote_path, local)
File "/usr/home/milki/git/dulwich/dulwich/client.py", line 204, in fetch
target.get_graph_walker(), f.write, progress)
File "/usr/home/milki/git/dulwich/dulwich/client.py", line 471, in fetch_pack
refs, server_capabilities = self._read_refs(proto)
File "/usr/home/milki/git/dulwich/dulwich/client.py", line 172, in _read_refs
return refs, set(server_capabilities)
TypeError: 'NoneType' object is not iterable
milki@cibo:~/git/dulwich$ fatal: The remote end hung up unexpectedly
from dulwich.client import get_transport_and_path
from dulwich.repo import Repo
from cStringIO import StringIO
def determine_wants(refs):
return refs.values()
# some local repo local = Repo('/tmp/local')
f = StringIO()
# /tmp/remote.git is an empty bare repo
client, remote_path = get_transport_and_path('milki@localhost:/tmp/remote.git')
remote_refs = client.fetch_pack(remote_path, determine_wants, local.get_graph_walker(), f.write)
####### output #######
Traceback (most recent call last):
File "client.py", line 23, in <module>
remote_refs = client.fetch_pack(remote_path, determine_wants, local.get_graph_walker(), f.write)
File "/usr/home/milki/git/dulwich/dulwich/client.py", line 471, in fetch_pack
refs, server_capabilities = self._read_refs(proto)
File "/usr/home/milki/git/dulwich/dulwich/client.py", line 172, in _read_refs
return refs, set(server_capabilities)
TypeError: 'NoneType' object is not iterable
milki@cibo:~/git/dulwich$ fatal: The remote end hung up unexpectedly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment