From 86df324d650de37e8fc311848b6a07718060c598 Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Thu, 28 Aug 2014 13:50:29 -0700 Subject: [PATCH] dashboard: quote metacharacters when searching for gcc commits LGTM=adg R=adg CC=golang-codereviews, iant https://golang.org/cl/131420043 --- dashboard/builder/env.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index 16af906d..cb38741c 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "runtime" "strings" @@ -184,12 +185,13 @@ func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (st } var errMsg string if isMirrored { - commitDesc, err := repo.Master.VCS.LogAtRev(repo.Path, hash, "{desc|escape}") + commitDesc, err := repo.Master.VCS.LogAtRev(repo.Path, hash, "{desc|firstline|escape}") if err != nil { return "", err } - logCmd = append(logCmd, "--grep", "'"+string(commitDesc)+"'", "--regexp-ignore-case") + quotedDesc := regexp.QuoteMeta(string(commitDesc)) + logCmd = append(logCmd, "--grep", quotedDesc, "--regexp-ignore-case", "--extended-regexp") errMsg = fmt.Sprintf("Failed to find a commit with a similar description to '%s'", string(commitDesc)) } else { commitDate, err := repo.Master.VCS.LogAtRev(repo.Path, hash, "{date|rfc3339date}")