소스 검색

Remember the offset only for objects seen earlier in the pack, rather than the complete object.

Jelmer Vernooij 16 년 전
부모
커밋
d6c7fc2adb
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      dulwich/pack.py

+ 6 - 2
dulwich/pack.py

@@ -371,6 +371,10 @@ def read_pack_tail(f):
 
 
 def unpack_object(map, offset=0):
+    """Unpack a Git object.
+
+    :return: tuple with type, uncompressed data and compressed size
+    """
     bytes = take_msb_bytes(map, offset)
     type = (bytes[0] >> 4) & 0x07
     size = bytes[0] & 0x0f
@@ -549,7 +553,7 @@ class PackData(object):
         def get_ref_text(sha):
             assert len(sha) == 20
             if sha in found:
-                return found[sha]
+                return self.get_object_at(found[sha])
             if ext_resolve_ref:
                 try:
                     return ext_resolve_ref(sha)
@@ -569,7 +573,7 @@ class PackData(object):
             else:
                 shafile = ShaFile.from_raw_string(type, obj)
                 sha = shafile.sha().digest()
-                found[sha] = (type, obj)
+                found[sha] = offset
                 yield sha, offset, crc32
                 extra.extend(postponed.get(sha, []))
         if postponed: