File tree 2 files changed +5
-13
lines changed
2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change 62
62
from binascii import crc32
63
63
64
64
from gitdb .const import NULL_BYTE
65
- from gitdb .utils .compat import to_bytes
66
65
67
66
import tempfile
68
67
import array
@@ -877,7 +876,11 @@ def collect_streams_at_offset(self, offset):
877
876
stream = streams [- 1 ]
878
877
while stream .type_id in delta_types :
879
878
if stream .type_id == REF_DELTA :
880
- sindex = self ._index .sha_to_index (to_bytes (stream .delta_info ))
879
+ # smmap can return memory view objects, which can't be compared as buffers/bytes can ...
880
+ if isinstance (stream .delta_info , memoryview ):
881
+ sindex = self ._index .sha_to_index (stream .delta_info .tobytes ())
882
+ else :
883
+ sindex = self ._index .sha_to_index (stream .delta_info )
881
884
if sindex is None :
882
885
break
883
886
stream = self ._pack .stream (self ._index .offset (sindex ))
Original file line number Diff line number Diff line change 2
2
3
3
PY3 = sys .version_info [0 ] == 3
4
4
5
- try :
6
- # Python 2
7
- def to_bytes (i ):
8
- return i
9
- except NameError :
10
- # smmap can return memory view objects, which can't be compared as buffers/bytes can ...
11
- def to_bytes (i ):
12
- if isinstance (i , memoryview ):
13
- return i .tobytes ()
14
- return i
15
-
16
5
try :
17
6
MAXSIZE = sys .maxint
18
7
except AttributeError :
You can’t perform that action at this time.
0 commit comments