Skip to content

Fix up the commit trailers functionality #1576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert the removal of Commit.trailers property.
  • Loading branch information
itsluketwist committed Apr 23, 2023
commit 9ef07a731caf39684891bce5cc92c4e91829138d
14 changes: 14 additions & 0 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,20 @@ def stats(self) -> Stats:
text = self.repo.git.diff(self.parents[0].hexsha, self.hexsha, "--", numstat=True, no_renames=True)
return Stats._list_from_string(self.repo, text)

@property
def trailers(self) -> Dict[str, str]:
"""Get the trailers of the message as a dictionary

:note: This property is deprecated, please use either ``Commit.trailers_list`` or ``Commit.trailers_dict``.

:return:
Dictionary containing whitespace stripped trailer information.
Only contains the latest instance of each trailer key.
"""
return {
k: v[0] for k, v in self.trailers_dict.items()
}

@property
def trailers_list(self) -> List[Tuple[str, str]]:
"""Get the trailers of the message as a list
Expand Down