File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1616 DecompressMemMapReader ,
1717 FDCompressedSha1Writer ,
1818 LooseObjectDB ,
19- Sha1Writer
19+ Sha1Writer ,
20+ MemoryDB ,
21+ IStream ,
2022)
2123from gitdb .util import hex_to_bin
2224
2729
2830import tempfile
2931import os
32+ from io import BytesIO
3033
3134class TestStream (TestBase ):
3235 """Test stream classes"""
@@ -144,11 +147,16 @@ def test_compressed_writer(self):
144147
145148 def test_decompress_reader_special_case (self ):
146149 odb = LooseObjectDB (fixture_path ('objects' ))
150+ mdb = MemoryDB ()
147151 for sha in ('888401851f15db0eed60eb1bc29dec5ddcace911' ,
148152 '7bb839852ed5e3a069966281bb08d50012fb309b' ,):
149153 ostream = odb .stream (hex_to_bin (sha ))
150154
151155 # if there is a bug, we will be missing one byte exactly !
152156 data = ostream .read ()
153157 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
154162 # end for each loose object sha to test
You can’t perform that action at this time.
0 commit comments