Signed-off-by: Rob Browning <
r...@defaultvalue.org>
Tested-by: Rob Browning <
r...@defaultvalue.org>
---
lib/bup/git.py | 2 +-
test/int/test_git.py | 15 +++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/bup/git.py b/lib/bup/git.py
index 2b13be06..3a3a2b49 100644
--- a/lib/bup/git.py
+++ b/lib/bup/git.py
@@ -1429,13 +1429,13 @@ class CatPipe:
if len(info) != 3 or len(info[0]) != 40:
raise GitError('expected object (id, type, size), got %r' % info)
oidx, typ, size = info
+ size = int(size)
if not include_data:
self.inprogress = None
yield oidx, typ, size
return
- size = int(size)
try:
it = chunkyreader(p.stdout, size)
yield oidx, typ, size
diff --git a/test/int/test_git.py b/test/int/test_git.py
index 83888621..1230ce16 100644
--- a/test/int/test_git.py
+++ b/test/int/test_git.py
@@ -403,11 +403,18 @@ def test_cat_pipe(tmpdir):
b'cat-file', b'-t', b'src').strip()
size = int(exo(b'git', b'--git-dir', bupdir,
b'cat-file', b'-s', b'src'))
+
it = git.cp().get(b'src')
- get_info = next(it)
- for buf in next(it):
- pass
- WVPASSEQ((oidx, typ, size), get_info)
+ assert (oidx, typ, size) == next(it)
+ data = b''.join(it)
+ assert data.startswith(b'tree ')
+ assert b'\nauthor ' in data
+ assert b'\ncommitter ' in data
+
+ it = git.cp().get(b'src', include_data=False)
+ assert (oidx, typ, size) == next(it)
+ assert b'' == b''.join(it)
+
def _create_idx(d, i):
idx = git.PackIdxV2Writer()
--
2.47.2