From ef3ac5f3ff401e694c7371e393075a7d490e78d2 Mon Sep 17 00:00:00 2001 From: melak Date: Sat, 1 Jul 2017 15:51:17 +0200 Subject: [PATCH] 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). --- commit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit.go b/commit.go index 0a95bc90b7aae..b24af93d9a73f 100644 --- a/commit.go +++ b/commit.go @@ -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).