Skip to content

Commit

Permalink
Trim commit message when generating Summary (go-gitea#75)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
melak authored and appleboy committed Jul 1, 2017
1 parent 7c4fc4e commit ef3ac5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (c *Commit) Message() string {

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

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

0 comments on commit ef3ac5f

Please sign in to comment.