Commit Diff


commit - a4d28b04c6d5f8192dac799b232cd77effce7163
commit + 1f3a66994f0359b1d376102ca19d8d73ac8171d1
blob - f6772af586b57446e50879c6a63e15e48c0161d5
blob + 937a7a27dd5383f04d4c9b38b7e4a371ab121465
--- NEWS
+++ NEWS
@@ -3,6 +3,15 @@
  * Add support for ``worktreeconfig`` extension.
    (Jelmer Vernooij)
 
+ * Deprecate ``Commit.extra``; the Git project specifically
+   discourages adding custom lines, and the contents of
+   ``Commit.extra`` are unpredictable as contents
+   may be different between different versions of Dulwich
+   with support for different headers.
+
+   ``Commit._extra`` still exists.
+   (Jelmer Vernooij)
+
 0.21.2	2023-01-18
 
  * Fix early file close bug in ``dulwich.pack.extend_pack``.
blob - 0c16e802f09bc0885d5dc552ee5e51b2c8704f1f
blob + b5909c97bd4f1352371fb741b0fbf9f0d6f09170
--- dulwich/objects.py
+++ dulwich/objects.py
@@ -36,6 +36,7 @@ from typing import (
     Iterator,
     List,
 )
+import warnings
 import zlib
 from _hashlib import HASH
 from hashlib import sha1
@@ -1567,6 +1568,9 @@ class Commit(ShaFile):
 
     def _get_extra(self):
         """Return extra settings of this commit."""
+        warnings.warn(
+            'Commit.extra is deprecated. Use Commit._extra instead.',
+            DeprecationWarning)
         return self._extra
 
     extra = property(