1
0
mirror of https://github.com/go-gitea/git.git synced 2026-02-05 06:45:03 +01:00

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).
This commit is contained in:
melak
2017-07-01 15:51:17 +02:00
committed by Bo-Yi Wu
parent 7c4fc4e5ca
commit ef3ac5f3ff

View File

@@ -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).