]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/git.py
CatPipe.get: report unexpected cat-file exit status
[bup.git] / lib / bup / git.py
index cccc44ef97655f79a8755d65990c55edae1c1e02..dbfe78f6e81d48b7e8a21bdad7b682899ea91b01 100644 (file)
@@ -263,8 +263,7 @@ def demangle_name(name, mode):
     elif name.endswith(b'.bupm'):
         return (name[:-5],
                 BUP_CHUNKED if stat.S_ISDIR(mode) else BUP_NORMAL)
-    else:
-        return (name, BUP_NORMAL)
+    return (name, BUP_NORMAL)
 
 
 def calc_hash(type, content):
@@ -1269,6 +1268,7 @@ class CatPipe:
         if wait:
             p.wait()
             return p.returncode
+        return None
 
     def restart(self):
         self.close()
@@ -1299,6 +1299,9 @@ class CatPipe:
         self.p.stdin.write(ref + b'\n')
         self.p.stdin.flush()
         hdr = self.p.stdout.readline()
+        if not hdr:
+            raise GitError('unexpected cat-file EOF (last request: %r, exit: %s)'
+                           % (ref, self.p.poll() or 'none'))
         if hdr.endswith(b' missing\n'):
             self.inprogress = None
             yield None, None, None