diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2014-12-29 14:56:24 -0800 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2014-12-30 00:31:51 +0000 |
| commit | 3076cb9dca59dbd37c3a58d9e428bfb2fe9d45bd (patch) | |
| tree | 1345ac39e31f0801bbfa9b9dee0019f0e9fb4f89 /git-codereview | |
| parent | cccc3b65d48c95a0e499de2dc77827098edd3d9e (diff) | |
| download | go-x-review-3076cb9dca59dbd37c3a58d9e428bfb2fe9d45bd.tar.xz | |
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>
Diffstat (limited to 'git-codereview')
| -rw-r--r-- | git-codereview/branch.go | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ func (b *Branch) Submitted(id string) bool { 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] `) |
