Skip to content

Commit 78424b5

Browse files
committed
Deprecate Commit.trailers.
1 parent d2f7284 commit 78424b5

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

git/objects/commit.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -335,24 +335,6 @@ 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-
Git messages can contain trailer information that are similar to RFC 822
343-
e-mail headers (see: https://git-scm.com/docs/git-interpret-trailers).
344-
345-
WARNING: This function only returns the latest instance of each trailer key
346-
and will be deprecated soon. Please see either ``Commit.trailers_list`` or ``Commit.trailers_dict``.
347-
348-
:return:
349-
Dictionary containing whitespace stripped trailer information.
350-
Only the latest instance of each trailer key.
351-
"""
352-
return {
353-
k: v[0] for k, v in self.trailers_dict.items()
354-
}
355-
356338
@property
357339
def trailers_list(self) -> List[str]:
358340
"""Get the trailers of the message as a list

test/test_commit.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,6 @@ def test_trailers(self):
523523
KEY_1: [VALUE_1_1, VALUE_1_2],
524524
KEY_2: [VALUE_2],
525525
}
526-
assert commit.trailers == {
527-
KEY_1: VALUE_1_1,
528-
KEY_2: VALUE_2,
529-
}
530526

531527
# check that trailer stays empty for multiple msg combinations
532528
msgs = [
@@ -543,14 +539,12 @@ def test_trailers(self):
543539
commit.message = msg
544540
assert commit.trailers_list == []
545541
assert commit.trailers_dict == {}
546-
assert commit.trailers == {}
547542

548543
# check that only the last key value paragraph is evaluated
549544
commit = copy.copy(self.rorepo.commit("master"))
550545
commit.message = f"Subject\n\nMultiline\nBody\n\n{KEY_1}: {VALUE_1_1}\n\n{KEY_2}: {VALUE_2}\n"
551546
assert commit.trailers_list == [f"{KEY_2}: {VALUE_2}"]
552547
assert commit.trailers_dict == {KEY_2: [VALUE_2]}
553-
assert commit.trailers == {KEY_2: VALUE_2}
554548

555549
def test_commit_co_authors(self):
556550
commit = copy.copy(self.rorepo.commit("4251bd5"))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy