Explorar o código

Merge fix for Commit._deserialize actually using passed in chunks. Thanks Yifan Zhang.

Jelmer Vernooij %!s(int64=12) %!d(string=hai) anos
pai
achega
c2e8f09e1c
Modificáronse 3 ficheiros con 12 adicións e 1 borrados
  1. 5 0
      NEWS
  2. 1 1
      dulwich/objects.py
  3. 6 0
      dulwich/tests/test_objects.py

+ 5 - 0
NEWS

@@ -14,6 +14,11 @@
     slightly different behaviour on various platforms.
     (Jelmer Vernooij)
 
+ BUG FIXES
+
+  * Commit._deserialize now actually deserializes the current state rather than
+    the previous one. (Yifan Zhang, issue #59)
+
 0.8.5	2012-03-29
 
  BUG FIXES

+ 1 - 1
dulwich/objects.py

@@ -1059,7 +1059,7 @@ class Commit(ShaFile):
         self._parents = []
         self._extra = []
         self._author = None
-        for field, value in parse_commit(''.join(self._chunked_text)):
+        for field, value in parse_commit(''.join(chunks)):
             if field == _TREE_HEADER:
                 self._tree = value
             elif field == _PARENT_HEADER:

+ 6 - 0
dulwich/tests/test_objects.py

@@ -307,6 +307,12 @@ class CommitSerializationTests(TestCase):
         c = self.make_commit(commit_timezone=(-1 * 3600))
         self.assertTrue(" -0100\n" in c.as_raw_string())
 
+    def test_deserialize(self):
+        c = self.make_commit()
+        d = Commit()
+        d._deserialize(c.as_raw_chunks())
+        self.assertEqual(c, d)
+
 
 default_committer = 'James Westby <jw+debian@jameswestby.net> 1174773719 +0000'