Jelajahi Sumber

Fix parsing pack objects.

Jelmer Vernooij 16 tahun lalu
induk
melakukan
baf8e13d37
2 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 1 0
      dulwich/objects.py
  2. 6 0
      dulwich/tests/test_pack.py

+ 1 - 0
dulwich/objects.py

@@ -142,6 +142,7 @@ class ShaFile(object):
     obj = real_class()
     obj._num_type = type
     obj._text = string
+    obj._parse_text()
     return obj
 
   def _header(self):

+ 6 - 0
dulwich/tests/test_pack.py

@@ -165,6 +165,12 @@ class TestPack(PackTests):
         write_pack("testcopy", list(p.iterobjects()))
         self.assertEquals(p, Pack("testcopy"))
 
+    def test_commit_obj(self):
+        p = self.get_pack(pack1_sha)
+        commit = p[commit_sha]
+        self.assertEquals("James Westby <jw+debian@jameswestby.net>", commit.author())
+        self.assertEquals([], commit.parents)
+
 
 class TestHexToSha(unittest.TestCase):