git-codereview: fix test regressions in TestMail*
Commit 8ef20ce (set x.mailed tag to mailed commit instead of HEAD) broke
TestMail, TestMailShort, and TestMailTopic.
Possibly related to golang/go#9602.
Change-Id: Iac5ea98d034ee4815b3b7ea2d5cc3f523944b953
Reviewed-on: https://go-review.googlesource.com/9312
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/git-codereview/mail_test.go b/git-codereview/mail_test.go
index 72a3f4e..e615b76 100644
--- a/git-codereview/mail_test.go
+++ b/git-codereview/mail_test.go
@@ -14,6 +14,8 @@
defer gt.done()
gt.work(t)
+ h := CurrentBranch().Pending()[0].ShortHash
+
// fake auth information to avoid Gerrit error
auth.host = "gerrit.fake"
auth.user = "not-a-user"
@@ -25,7 +27,7 @@
testMain(t, "mail")
testRan(t,
"git push -q origin HEAD:refs/for/master",
- "git tag -f work.mailed")
+ "git tag -f work.mailed "+h)
}
func TestMailGitHub(t *testing.T) {
@@ -87,20 +89,22 @@
// Do some work.
gt.work(t)
+ h := CurrentBranch().Pending()[0].ShortHash
+
testMain(t, "mail")
testRan(t,
"git push -q origin HEAD:refs/for/master",
- "git tag -f work.mailed")
+ "git tag -f work.mailed "+h)
testMain(t, "mail", "-r", "r1")
testRan(t,
"git push -q origin HEAD:refs/for/master%r=r1@golang.org",
- "git tag -f work.mailed")
+ "git tag -f work.mailed "+h)
testMain(t, "mail", "-r", "other,anon", "-cc", "r1,full@email.com")
testRan(t,
"git push -q origin HEAD:refs/for/master%r=other@golang.org,r=anon@golang.org,cc=r1@golang.org,cc=full@email.com",
- "git tag -f work.mailed")
+ "git tag -f work.mailed "+h)
testMainDied(t, "mail", "-r", "other", "-r", "anon,r1,missing")
testPrintedStderr(t, "unknown reviewer: missing")
@@ -111,6 +115,8 @@
defer gt.done()
gt.work(t)
+ h := CurrentBranch().Pending()[0].ShortHash
+
// fake auth information to avoid Gerrit error
auth.host = "gerrit.fake"
auth.user = "not-a-user"
@@ -125,5 +131,5 @@
testMain(t, "mail", "-topic", "test-topic")
testRan(t,
"git push -q origin HEAD:refs/for/master%topic=test-topic",
- "git tag -f work.mailed")
+ "git tag -f work.mailed "+h)
}