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:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user