Skip to content

Commit 03464d9

Browse files
committed
Have the deprecated Commit.trailers property issue a warning
1 parent 2c52696 commit 03464d9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: git/objects/commit.py

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from subprocess import Popen, PIPE
1515
import sys
1616
from time import altzone, daylight, localtime, time, timezone
17+
import warnings
1718

1819
from gitdb import IStream
1920

@@ -399,6 +400,11 @@ def trailers(self) -> Dict[str, str]:
399400
Dictionary containing whitespace stripped trailer information.
400401
Only contains the latest instance of each trailer key.
401402
"""
403+
warnings.warn(
404+
"Commit.trailers is deprecated, use Commit.trailers_list or Commit.trailers_dict instead",
405+
DeprecationWarning,
406+
stacklevel=2,
407+
)
402408
return {k: v[0] for k, v in self.trailers_dict.items()}
403409

404410
@property

0 commit comments

Comments
 (0)