diff --git a/remote/bitbucket/convert.go b/remote/bitbucket/convert.go index dc4e0437e..bc6d9171e 100644 --- a/remote/bitbucket/convert.go +++ b/remote/bitbucket/convert.go @@ -193,10 +193,12 @@ func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Bu return build } +// regex for git author fields ("name ") +var reGitMail = regexp.MustCompile("<(.*)>") + // extracts the email from a git commit author string func extractEmail(gitauthor string) (author string) { - re := regexp.MustCompile("<(.*)>") - matches := re.FindAllStringSubmatch(gitauthor,-1) + matches := reGitMail.FindAllStringSubmatch(gitauthor,-1) if len(matches) == 1 { author = matches[0][1] }