Skip to content

Commit

Permalink
fix: Clean up body to fix parsing trailers
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 2, 2023
1 parent bea7d14 commit 1183c25
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/git_changelog/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
from git_changelog.providers import ProviderRefParser, Ref


def _clean_body(lines: list[str]):
while lines and not lines[0].strip():
lines.pop(0)
while lines and not lines[-1].strip():
lines.pop()
return lines


class Commit:
"""A class to represent a commit."""

Expand Down Expand Up @@ -64,7 +72,7 @@ def __init__( # noqa: WPS231
self.committer_email: str = committer_email
self.committer_date: datetime = committer_date
self.subject: str = subject
self.body: list[str] = body or []
self.body: list[str] = _clean_body(body) if body else []
self.url: str = url

tag = ""
Expand Down

0 comments on commit 1183c25

Please sign in to comment.