X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=git.py;h=6775bb2876a7d8c10d98b65027db432a4438fe77;hb=7f45493d9b35ea16cb7514e2a39ece16354e4449;hp=ccafa5c8b7e8eedd6e842d51cd70e78385386dfe;hpb=f76cb0d6e8f6f2d3be09287db72a26acdb01b3bb;p=bup.git diff --git a/git.py b/git.py index ccafa5c..6775bb2 100644 --- 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)):