summaryrefslogtreecommitdiff
path: root/gitdb
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-12 19:10:42 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-12 19:10:42 +0100
commit5b0dc5f89a666f450f39ef0002cf6d1761ecfca8 (patch)
tree1fcd5d0270df6175107bf7d945a78f3154c5743b /gitdb
parent1b07e4dbd3297f8b09d568c54b008d57aa64cc78 (diff)
downloadgitdb-5b0dc5f89a666f450f39ef0002cf6d1761ecfca8.tar.gz
Adjusted stream logic to make it work on all tested platforms ... .
As taken from https://github.com/gitpython-developers/gitdb/blob/master/gitdb/stream.py#L292 -> NOTE: Behavior changed in PY2.7 onward, which requires special handling to make the tests work properly. They are thorough, and I assume it is truly working. Why is this logic as convoluted as it is ? Please look at the table in https://github.com/gitpython-developers/gitdb/issues/19 to learn about the test-results. Bascially, on py2.6, you want to use branch 1, whereas on all other python version, the second branch will be the one that works. However, the zlib VERSIONs as well as the platform check is used to further match the entries in the table in the github issue. This is it ... it was the only way I could make this work everywhere. IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . <- Fixes #19
Diffstat (limited to 'gitdb')
-rw-r--r--gitdb/fun.py2
-rw-r--r--gitdb/pack.py1
-rw-r--r--gitdb/stream.py12
3 files changed, 11 insertions, 4 deletions
diff --git a/gitdb/fun.py b/gitdb/fun.py
index 17da4e5..ac9d993 100644
--- a/gitdb/fun.py
+++ b/gitdb/fun.py
@@ -426,7 +426,7 @@ def pack_object_header_info(data):
s = 4 # starting bit-shift size
if PY3:
while c & 0x80:
- c = data[i]
+ c = byte_ord(data[i])
i += 1
size += (c & 0x7f) << s
s += 7
diff --git a/gitdb/pack.py b/gitdb/pack.py
index d2666d6..511e557 100644
--- a/gitdb/pack.py
+++ b/gitdb/pack.py
@@ -552,6 +552,7 @@ class PackFile(LazyMixin):
# the amount of compressed bytes we need to get to the next offset
stream_copy(ostream.read, null.write, ostream.size, chunk_size)
+ assert ostream.stream._br == ostream.size
cur_offset += (data_offset - ostream.pack_offset) + ostream.stream.compressed_bytes_read()
# if a stream is requested, reset it beforehand
diff --git a/gitdb/stream.py b/gitdb/stream.py
index aaf5820..04dd79f 100644
--- a/gitdb/stream.py
+++ b/gitdb/stream.py
@@ -289,11 +289,18 @@ class DecompressMemMapReader(LazyMixin):
# if we hit the end of the stream
# NOTE: Behavior changed in PY2.7 onward, which requires special handling to make the tests work properly.
# They are thorough, and I assume it is truly working.
- if PY26:
+ # Why is this logic as convoluted as it is ? Please look at the table in
+ # https://github.com/gitpython-developers/gitdb/issues/19 to learn about the test-results.
+ # Bascially, on py2.6, you want to use branch 1, whereas on all other python version, the second branch
+ # will be the one that works.
+ # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the
+ # table in the github issue. This is it ... it was the only way I could make this work everywhere.
+ # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... .
+ if PY26 or ((zlib.ZLIB_VERSION == '1.2.7' or zlib.ZLIB_VERSION == '1.2.5') and not sys.platform == 'darwin'):
unused_datalen = len(self._zip.unconsumed_tail)
else:
unused_datalen = len(self._zip.unconsumed_tail) + len(self._zip.unused_data)
- # end handle very special case ...
+ # # end handle very special case ...
self._cbr += len(indata) - unused_datalen
self._br += len(dcompdat)
@@ -374,7 +381,6 @@ class DeltaApplyReader(LazyMixin):
# Aggregate all deltas into one delta in reverse order. Hence we take
# the last delta, and reverse-merge its ancestor delta, until we receive
# the final delta data stream.
- # print "Handling %i delta streams, sizes: %s" % (len(self._dstreams), [ds.size for ds in self._dstreams])
dcl = connect_deltas(self._dstreams)
# call len directly, as the (optional) c version doesn't implement the sequence