summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--releaser/git.go2
-rw-r--r--releaser/git_test.go10
2 files changed, 11 insertions, 1 deletions
diff --git a/releaser/git.go b/releaser/git.go
index 4db1c2329..a03a48e99 100644
--- a/releaser/git.go
+++ b/releaser/git.go
@@ -23,7 +23,7 @@ import (
"github.com/gohugoio/hugo/common/hexec"
)
-var issueRe = regexp.MustCompile(`(?i)[Updates?|Closes?|Fix.*|See] #(\d+)`)
+var issueRe = regexp.MustCompile(`(?i)(?:Updates?|Closes?|Fix.*|See) #(\d+)`)
const (
notesChanges = "notesChanges"
diff --git a/releaser/git_test.go b/releaser/git_test.go
index 21d261a62..ff77eb8c6 100644
--- a/releaser/git_test.go
+++ b/releaser/git_test.go
@@ -45,6 +45,16 @@ See #456
c.Assert(len(issues), qt.Equals, 4)
c.Assert(issues[0], qt.Equals, 123)
c.Assert(issues[2], qt.Equals, 543)
+
+ bodyNoIssues := `
+This is a commit message without issue refs.
+
+But it has e #10 to make old regexp confused.
+Streets #20.
+ `
+
+ emptyIssuesList := extractIssues(bodyNoIssues)
+ c.Assert(len(emptyIssuesList), qt.Equals, 0)
}
func TestGitVersionTagBefore(t *testing.T) {