]> arthur.barton.de Git - bup.git/blobdiff - git.py
Start using wvtest.sh for shell-based tests in test-sh.
[bup.git] / git.py
diff --git a/git.py b/git.py
index ccafa5c8b7e8eedd6e842d51cd70e78385386dfe..6775bb2876a7d8c10d98b65027db432a4438fe77 100644 (file)
--- a/git.py
+++ b/git.py
@@ -398,9 +398,11 @@ class CatPipe:
         assert(id[0] != '-')
         self.p.stdin.write('%s\n' % id)
         hdr = self.p.stdout.readline()
+        if hdr.endswith(' missing\n'):
+            raise GitError('blob %r is missing' % id)
         spl = hdr.split(' ')
-        assert(len(spl) == 3)
-        assert(len(spl[0]) == 40)
+        if len(spl) != 3 or len(spl[0]) != 40:
+            raise GitError('expected blob, got %r' % spl)
         (hex, type, size) = spl
         yield type
         for blob in chunkyreader(self.p.stdout, int(spl[2])):
@@ -437,7 +439,8 @@ class CatPipe:
             for blob in self.join(treeline[5:]):
                 yield blob
         else:
-            raise GitError('unknown object type %r' % type)
+            raise GitError('invalid object type %r: expected blob/tree/commit'
+                           % type)
 
     def join(self, id):
         for d in self._join(self.get(id)):