Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 46bf471

Browse files
committed
PackEntity: fixed capital bug which would cause a None to be in place of the bin sha when querying infos or streams through an entity
1 parent 6c8721a commit 46bf471

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

ext/async

Submodule async updated from a182352 to 76f15fc

pack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ def _object(self, sha, as_stream, index=-1):
516516
# its a little bit redundant here, but it needs to be efficient
517517
if index < 0:
518518
index = self._sha_to_index(sha)
519+
if sha is None:
520+
sha = self._index.sha(index)
521+
# END assure sha is present ( in output )
519522
offset = self._index.offset(index)
520523
type_id, uncomp_size, data_rela_offset = pack_object_header_info(buffer(self._pack._data, offset))
521524
if as_stream:
@@ -551,7 +554,6 @@ def _object(self, sha, as_stream, index=-1):
551554
# collect the streams to obtain the actual object type
552555
if streams[-1].type_id in delta_types:
553556
raise BadObject(sha, "Could not resolve delta object")
554-
555557
return OInfo(sha, streams[-1].type, target_size)
556558
# END handle stream
557559

test/test_pack.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,12 @@ def test_pack_entity(self):
144144

145145
# try all calls
146146
assert len(entity.collect_streams(info.binsha))
147-
assert isinstance(entity.info(info.binsha), OInfo)
148-
assert isinstance(entity.stream(info.binsha), OStream)
147+
oinfo = entity.info(info.binsha)
148+
assert isinstance(oinfo, OInfo)
149+
assert oinfo.binsha is not None
150+
ostream = entity.stream(info.binsha)
151+
assert isinstance(ostream, OStream)
152+
assert ostream.binsha is not None
149153

150154
# verify the stream
151155
try:

0 commit comments

Comments
 (0)