summaryrefslogtreecommitdiff
path: root/gitdb/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-01 13:47:19 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-01 13:47:19 +0100
commitc38bd19706abe5cf0bf0e7b3e9ad2b3e554d28ef (patch)
treef9572b510b81fc1dafab8dbe049f64c41f76d570 /gitdb/test
parentab4520683ab325046f2a9fe6ebf127dbbab60dfe (diff)
downloadgitdb-c38bd19706abe5cf0bf0e7b3e9ad2b3e554d28ef.tar.gz
Increased initial size of decompressed data to obtain loose object header information
This appears to fix https://github.com/gitpython-developers/GitPython/issues/220 , in this particular case. Nonetheless, we might just have gotten lucky here, and the actual issue is not yet solved and can thus re-occour. It would certainly be best to churn through plenty of loose objects to assure this truly works now. Maybe the pack could be recompressed as loose objects to get a sufficiently large data set
Diffstat (limited to 'gitdb/test')
-rw-r--r--gitdb/test/fixtures/objects/88/8401851f15db0eed60eb1bc29dec5ddcace911bin0 -> 222336 bytes
-rw-r--r--gitdb/test/performance/test_pack.py3
-rw-r--r--gitdb/test/test_stream.py13
3 files changed, 10 insertions, 6 deletions
diff --git a/gitdb/test/fixtures/objects/88/8401851f15db0eed60eb1bc29dec5ddcace911 b/gitdb/test/fixtures/objects/88/8401851f15db0eed60eb1bc29dec5ddcace911
new file mode 100644
index 0000000..d60aeef
--- /dev/null
+++ b/gitdb/test/fixtures/objects/88/8401851f15db0eed60eb1bc29dec5ddcace911
Binary files differ
diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py
index db3b48d..97c450d 100644
--- a/gitdb/test/performance/test_pack.py
+++ b/gitdb/test/performance/test_pack.py
@@ -63,7 +63,8 @@ class TestPackedDBPerformance(TestBigRepoR):
st = time()
for sha in sha_list[:max_items]:
stream = pdb_stream(sha)
- stream.read()
+ read_len = len(stream.read())
+ assert read_len == stream.size
total_size += stream.size
elapsed = time() - st
total_kib = total_size / 1000
diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py
index 50db44b..eab9a19 100644
--- a/gitdb/test/test_stream.py
+++ b/gitdb/test/test_stream.py
@@ -144,8 +144,11 @@ class TestStream(TestBase):
def test_decompress_reader_special_case(self):
odb = LooseObjectDB(fixture_path('objects'))
- ostream = odb.stream(hex_to_bin('7bb839852ed5e3a069966281bb08d50012fb309b'))
-
- # if there is a bug, we will be missing one byte exactly !
- data = ostream.read()
- assert len(data) == ostream.size
+ for sha in ('888401851f15db0eed60eb1bc29dec5ddcace911',
+ '7bb839852ed5e3a069966281bb08d50012fb309b',):
+ ostream = odb.stream(hex_to_bin(sha))
+
+ # if there is a bug, we will be missing one byte exactly !
+ data = ostream.read()
+ assert len(data) == ostream.size
+ # end for each loose object sha to test