Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit ef3ac5f

Browse files
melakappleboy
authored andcommitted
Trim commit message when generating Summary (#75)
Commit messages with superfluous empty lines on the top generate empty summaries. Trim the commit message so the summary contains something meaningful (as far as the commit message permits).
1 parent 7c4fc4e commit ef3ac5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (c *Commit) Message() string {
5454

5555
// Summary returns first line of commit message.
5656
func (c *Commit) Summary() string {
57-
return strings.Split(c.CommitMessage, "\n")[0]
57+
return strings.Split(strings.TrimSpace(c.CommitMessage), "\n")[0]
5858
}
5959

6060
// ParentID returns oid of n-th parent (0-based index).

0 commit comments

Comments
 (0)