GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Deprecate Commit.trailers. · gitpython-developers/GitPython@78424b5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • git/objects
    • commit.py
  • test
    • test_commit.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/objects/commit.py‎

Copy file name to clipboardExpand all lines: git/objects/commit.py
-18Lines 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
Collapse file

‎test/test_commit.py‎

Copy file name to clipboardExpand all lines: test/test_commit.py
-6Lines 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 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.