Skip to content

Commit

Permalink
Have the deprecated Commit.trailers property issue a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Mar 28, 2024
1 parent 2c52696 commit 03464d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from subprocess import Popen, PIPE
import sys
from time import altzone, daylight, localtime, time, timezone
import warnings

from gitdb import IStream

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

@property
Expand Down

0 comments on commit 03464d9

Please sign in to comment.