diff options
| author | Russ Cox <rsc@golang.org> | 2021-01-07 12:26:06 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2021-01-07 17:26:24 +0000 |
| commit | 541f6aec3b30c1bd064ea95cdaaf57f4e65bef4d (patch) | |
| tree | 660810907f7bd23d80f421446509fb685d041b59 /git-codereview/change_test.go | |
| parent | 9593f86427dedbe2eda472886bd2a4f8c965abf5 (diff) | |
| download | go-x-review-541f6aec3b30c1bd064ea95cdaaf57f4e65bef4d.tar.xz | |
git-codereview: update tests for "main" branch default
"git init ." leaves me on "main" now, not "master".
Update tests to expect that, and update the "tracking" message too
(otherwise the tests fail).
Because not all gits agree about the initial branch name,
set it explicitly too in the test.
Fixes #42926.
Change-Id: If3adb3bb53beba9efcd75cad0f081f59fba85fe7
Reviewed-on: https://go-review.googlesource.com/c/review/+/279873
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'git-codereview/change_test.go')
| -rw-r--r-- | git-codereview/change_test.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/git-codereview/change_test.go b/git-codereview/change_test.go index e9337dc..206ed82 100644 --- a/git-codereview/change_test.go +++ b/git-codereview/change_test.go @@ -14,28 +14,28 @@ func TestChange(t *testing.T) { gt := newGitTest(t) defer gt.done() - t.Logf("master -> master") - testMain(t, "change", "master") - testRan(t, "git checkout -q master") + t.Logf("main -> main") + testMain(t, "change", "main") + testRan(t, "git checkout -q main") testCommitMsg = "foo: my commit msg" - t.Logf("master -> work") + t.Logf("main -> work") testMain(t, "change", "work") testRan(t, "git checkout -q -b work", - "git branch -q --set-upstream-to origin/master") + "git branch -q --set-upstream-to origin/main") - t.Logf("work -> master") - testMain(t, "change", "master") - testRan(t, "git checkout -q master") + t.Logf("work -> main") + testMain(t, "change", "main") + testRan(t, "git checkout -q main") - t.Logf("master -> work with staged changes") + t.Logf("main -> work with staged changes") write(t, gt.client+"/file", "new content", 0644) trun(t, gt.client, "git", "add", "file") testMain(t, "change", "work") testRan(t, "git checkout -q work", "git commit -q --allow-empty -m foo: my commit msg") - t.Logf("master -> dev.branch") + t.Logf("main -> dev.branch") testMain(t, "change", "dev.branch") testRan(t, "git checkout -q -t -b dev.branch origin/dev.branch") } @@ -52,13 +52,13 @@ func TestChangeAhead(t *testing.T) { gt := newGitTest(t) defer gt.done() - // commit to master (mistake) + // commit to main (mistake) write(t, gt.client+"/file", "new content", 0644) trun(t, gt.client, "git", "add", "file") trun(t, gt.client, "git", "commit", "-m", "msg") testMainDied(t, "change", "work") - testPrintedStderr(t, "bad repo state: branch master is ahead of origin/master") + testPrintedStderr(t, "bad repo state: branch main is ahead of origin/main") } func TestMessageRE(t *testing.T) { @@ -117,7 +117,7 @@ func TestChangeCL(t *testing.T) { // Ensure that 'change' with a CL accepts we have gerrit. Test address is injected by newGerritServer. write(t, gt.server+"/codereview.cfg", "gerrit: on", 0644) trun(t, gt.server, "git", "add", "codereview.cfg") - trun(t, gt.server, "git", "commit", "-m", "codereview.cfg on master") + trun(t, gt.server, "git", "commit", "-m", "codereview.cfg on main") trun(t, gt.client, "git", "pull") defer srv.done() @@ -140,7 +140,7 @@ func TestChangeCL(t *testing.T) { }}) checkChangeCL := func(arg, ref, hash string) { - testMain(t, "change", "master") + testMain(t, "change", "main") testMain(t, "change", arg) testRan(t, fmt.Sprintf("git fetch -q origin %s", ref), |
