File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 16
16
DecompressMemMapReader ,
17
17
FDCompressedSha1Writer ,
18
18
LooseObjectDB ,
19
- Sha1Writer
19
+ Sha1Writer ,
20
+ MemoryDB ,
21
+ IStream ,
20
22
)
21
23
from gitdb .util import hex_to_bin
22
24
27
29
28
30
import tempfile
29
31
import os
32
+ from io import BytesIO
30
33
31
34
class TestStream (TestBase ):
32
35
"""Test stream classes"""
@@ -144,11 +147,16 @@ def test_compressed_writer(self):
144
147
145
148
def test_decompress_reader_special_case (self ):
146
149
odb = LooseObjectDB (fixture_path ('objects' ))
150
+ mdb = MemoryDB ()
147
151
for sha in ('888401851f15db0eed60eb1bc29dec5ddcace911' ,
148
152
'7bb839852ed5e3a069966281bb08d50012fb309b' ,):
149
153
ostream = odb .stream (hex_to_bin (sha ))
150
154
151
155
# if there is a bug, we will be missing one byte exactly !
152
156
data = ostream .read ()
153
157
assert len (data ) == ostream .size
158
+
159
+ # Putting it back in should yield nothing new - after all, we have
160
+ dump = mdb .store (IStream (ostream .type , ostream .size , BytesIO (data )))
161
+ assert dump .hexsha == sha
154
162
# end for each loose object sha to test
You can’t perform that action at this time.
0 commit comments