Skip to content

Commit 9ef07a7

Browse files
committed
Revert the removal of Commit.trailers property.
1 parent ed36bd9 commit 9ef07a7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

git/objects/commit.py

+14
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,20 @@ def stats(self) -> Stats:
335335
text = self.repo.git.diff(self.parents[0].hexsha, self.hexsha, "--", numstat=True, no_renames=True)
336336
return Stats._list_from_string(self.repo, text)
337337

338+
@property
339+
def trailers(self) -> Dict[str, str]:
340+
"""Get the trailers of the message as a dictionary
341+
342+
:note: This property is deprecated, please use either ``Commit.trailers_list`` or ``Commit.trailers_dict``.
343+
344+
:return:
345+
Dictionary containing whitespace stripped trailer information.
346+
Only contains the latest instance of each trailer key.
347+
"""
348+
return {
349+
k: v[0] for k, v in self.trailers_dict.items()
350+
}
351+
338352
@property
339353
def trailers_list(self) -> List[Tuple[str, str]]:
340354
"""Get the trailers of the message as a list

0 commit comments

Comments
 (0)