client: don't assume server response is of length 20
[jelmer/dulwich-libgit2.git] / dulwich / object_store.py
index ca26348ef495ac1b79f296fefdf55615ce5a1dc8..461fc17e41456ee77c26e5c867dc3c64abe337d2 100644 (file)
@@ -470,8 +470,11 @@ class DiskObjectStore(PackBasedObjectStore):
         :param obj: Object to add
         """
         dir = os.path.join(self.path, obj.id[:2])
-        if not os.path.isdir(dir):
+        try:
             os.mkdir(dir)
+        except OSError, e:
+            if e.errno != errno.EEXIST:
+                raise
         path = os.path.join(dir, obj.id[2:])
         if os.path.exists(path):
             return # Already there, no need to write again
@@ -691,7 +694,12 @@ class MissingObjectFinder(object):
 
 
 class ObjectStoreGraphWalker(object):
-    """Graph walker that finds out what commits are missing from an object store."""
+    """Graph walker that finds out what commits are missing from an object 
+    store.
+    
+    :ivar heads: Revisions without descendants in the local repo
+    :ivar get_parents: Function to retrieve parents in the local repo
+    """
 
     def __init__(self, local_heads, get_parents):
         """Create a new instance.
@@ -704,7 +712,7 @@ class ObjectStoreGraphWalker(object):
         self.parents = {}
 
     def ack(self, sha):
-        """Ack that a particular revision and its ancestors are present in the source."""
+        """Ack that a revision and its ancestors are present in the source."""
         if sha in self.heads:
             self.heads.remove(sha)
         if sha in self.parents: