git-codereview: make Branch.Submitted pickier

Insist that the search term show up in the output.
This prevents unrelated junk output
from generating false positives.

Treat the search term as a fixed string
rather than a regular expression,
since that's what it is.

Limit the number of matches to 1.
git log is fast, but why waste cycles?

Updates golang/go#9468

Change-Id: I3ff1ab48785234481543c524a99270b9ecc0ed8e
Reviewed-on: https://go-review.googlesource.com/2155
Reviewed-by: Chris Manghane <cmang@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/git-codereview/branch.go b/git-codereview/branch.go
index 40288c7..a16de5e 100644
--- a/git-codereview/branch.go
+++ b/git-codereview/branch.go
@@ -156,7 +156,9 @@
 	if id == "" {
 		return false
 	}
-	return len(getOutput("git", "log", "--grep", "Change-Id: "+id, b.Name+".."+b.OriginBranch())) > 0
+	line := "Change-Id: " + id
+	out := getOutput("git", "log", "-n", "1", "-F", "--grep", line, b.Name+".."+b.OriginBranch())
+	return strings.Contains(out, line)
 }
 
 var stagedRE = regexp.MustCompile(`^[ACDMR]  `)