diff options
author | Twist <itsluketwist@gmail.com> | 2023-04-22 17:19:20 +0100 |
---|---|---|
committer | Twist <itsluketwist@gmail.com> | 2023-04-22 17:19:20 +0100 |
commit | 78424b56654ad476da4bd2faf88d3875c5265e0d (patch) | |
tree | 366e2f7709804e46005b3aa6f7d48b3053e67caf | |
parent | d2f7284189b5c1f867ebd58b0b879fa34406eefc (diff) | |
download | gitpython-78424b56654ad476da4bd2faf88d3875c5265e0d.tar.gz |
Deprecate Commit.trailers.
-rw-r--r-- | git/objects/commit.py | 18 | ||||
-rw-r--r-- | test/test_commit.py | 6 |
2 files changed, 0 insertions, 24 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index 50da0a10..1e3f751b 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -336,24 +336,6 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable): return Stats._list_from_string(self.repo, text) @property - def trailers(self) -> Dict[str, str]: - """Get the trailers of the message as a dictionary - - Git messages can contain trailer information that are similar to RFC 822 - e-mail headers (see: https://git-scm.com/docs/git-interpret-trailers). - - WARNING: This function only returns the latest instance of each trailer key - and will be deprecated soon. Please see either ``Commit.trailers_list`` or ``Commit.trailers_dict``. - - :return: - Dictionary containing whitespace stripped trailer information. - Only 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[str]: """Get the trailers of the message as a list diff --git a/test/test_commit.py b/test/test_commit.py index ca1e4752..8d2ee754 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -523,10 +523,6 @@ JzJMZDRLQLFvnzqZuCjE KEY_1: [VALUE_1_1, VALUE_1_2], KEY_2: [VALUE_2], } - assert commit.trailers == { - KEY_1: VALUE_1_1, - KEY_2: VALUE_2, - } # check that trailer stays empty for multiple msg combinations msgs = [ @@ -543,14 +539,12 @@ JzJMZDRLQLFvnzqZuCjE commit.message = msg assert commit.trailers_list == [] assert commit.trailers_dict == {} - assert commit.trailers == {} # check that only the last key value paragraph is evaluated commit = copy.copy(self.rorepo.commit("master")) commit.message = f"Subject\n\nMultiline\nBody\n\n{KEY_1}: {VALUE_1_1}\n\n{KEY_2}: {VALUE_2}\n" assert commit.trailers_list == [f"{KEY_2}: {VALUE_2}"] assert commit.trailers_dict == {KEY_2: [VALUE_2]} - assert commit.trailers == {KEY_2: VALUE_2} def test_commit_co_authors(self): commit = copy.copy(self.rorepo.commit("4251bd5")) |