Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion commitizen/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, rev, title, body=""):

@property
def message(self):
return f"{self.title}\n\n{self.body}"
return f"{self.title}\n\n{self.body}".strip()

def __repr__(self):
return f"{self.title} ({self.rev})"
Expand Down
7 changes: 7 additions & 0 deletions tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ def test_get_tag_names(mocker):
"commitizen.cmd.run", return_value=FakeCommand(out="", err="No tag available")
)
assert git.get_tag_names() == []


def test_git_message_with_empty_body():
commit_title = "Some Title"
commit = git.GitCommit("test_rev", "Some Title", body="")

assert commit.message == commit_title