Commit Diff


commit - 23a986ac9b36c32b5cda8e3fd4aa6a74e0638665
commit + e439305e96db3ab8db426afa5e1fe5e8ce118464
blob - 54dad1a28e6e553b9328e1677078fe80bc1a757c
blob + b86f86c3eb89500e498eec6bb3a882096d850d1f
--- dulwich/objects.py
+++ dulwich/objects.py
@@ -1522,7 +1522,7 @@ class Commit(ShaFile):
             # No trailing empty line
             if chunks[-1].endswith(b" \n"):
                 chunks[-1] = chunks[-1][:-2]
-        for k, v in self.extra:
+        for k, v in self._extra:
             if b"\n" in k or b"\n" in v:
                 raise AssertionError("newline in extra data: {!r} -> {!r}".format(k, v))
             chunks.append(git_line(k, v))
@@ -1556,7 +1556,7 @@ class Commit(ShaFile):
         """Return extra settings of this commit."""
         warnings.warn(
             'Commit.extra is deprecated. Use Commit._extra instead.',
-            DeprecationWarning)
+            DeprecationWarning, stacklevel=2)
         return self._extra
 
     extra = property(
blob - 2da115eed6dae68005cfab67193f423407a680f4
blob + 281c2df54c1f0dc37a9aca7bdc280d5f72bf371e
--- dulwich/tests/test_objects.py
+++ dulwich/tests/test_objects.py
@@ -599,7 +599,7 @@ class CommitParseTests(ShaFileCheckTests):
 
     def test_custom(self):
         c = Commit.from_string(self.make_commit_text(extra={b"extra-field": b"data"}))
-        self.assertEqual([(b"extra-field", b"data")], c.extra)
+        self.assertEqual([(b"extra-field", b"data")], c._extra)
 
     def test_encoding(self):
         c = Commit.from_string(self.make_commit_text(encoding=b"UTF-8"))
@@ -732,7 +732,7 @@ foo
 """
         )
         self.assertEqual(b"foo\n", c.message)
-        self.assertEqual([], c.extra)
+        self.assertEqual([], c._extra)
         self.assertEqual(
             b"""-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
@@ -776,7 +776,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----
 3.3.0 version bump and docs
 """
         )
-        self.assertEqual([], c.extra)
+        self.assertEqual([], c._extra)
         self.assertEqual(
             b"""\
 -----BEGIN PGP SIGNATURE-----