From c4927e21c560c98b147ee3e9912366e69b113011 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 17 May 2024 21:08:53 +0200 Subject: [PATCH] Rename PushBranch to PushBranchAndSetUpstream It is unexpected that a function called PushBranch also sets the upstream branch; also, we want to add a PushBranch function in the next commit that doesn't. --- pkg/integration/components/shell.go | 2 +- pkg/integration/tests/branch/delete.go | 4 ++-- .../branch/delete_remote_branch_with_credential_prompt.go | 2 +- pkg/integration/tests/branch/rebase_to_upstream.go | 2 +- pkg/integration/tests/branch/reset_to_upstream.go | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/integration/components/shell.go b/pkg/integration/components/shell.go index e3df61a50..8d18361fb 100644 --- a/pkg/integration/components/shell.go +++ b/pkg/integration/components/shell.go @@ -194,7 +194,7 @@ func (self *Shell) CreateAnnotatedTag(name string, message string, ref string) * return self.RunCommand([]string{"git", "tag", "-a", name, "-m", message, ref}) } -func (self *Shell) PushBranch(upstream, branch string) *Shell { +func (self *Shell) PushBranchAndSetUpstream(upstream, branch string) *Shell { return self.RunCommand([]string{"git", "push", "--set-upstream", upstream, branch}) } diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 0b6adfac4..f81eb0609 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -15,9 +15,9 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ CloneIntoRemote("origin"). EmptyCommit("blah"). NewBranch("branch-one"). - PushBranch("origin", "branch-one"). + PushBranchAndSetUpstream("origin", "branch-one"). NewBranch("branch-two"). - PushBranch("origin", "branch-two"). + PushBranchAndSetUpstream("origin", "branch-two"). EmptyCommit("deletion blocker"). NewBranch("branch-three") }, diff --git a/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go b/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go index f145eceaa..ad8f70c43 100644 --- a/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go +++ b/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go @@ -18,7 +18,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe shell.NewBranch("mybranch") - shell.PushBranch("origin", "mybranch") + shell.PushBranchAndSetUpstream("origin", "mybranch") // actually getting a password prompt is tricky: it requires SSH'ing into localhost under a newly created, restricted, user. // This is not easy to do in a cross-platform way, nor is it easy to do in a docker container. diff --git a/pkg/integration/tests/branch/rebase_to_upstream.go b/pkg/integration/tests/branch/rebase_to_upstream.go index 5c9e0f388..2469eb012 100644 --- a/pkg/integration/tests/branch/rebase_to_upstream.go +++ b/pkg/integration/tests/branch/rebase_to_upstream.go @@ -15,7 +15,7 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{ CloneIntoRemote("origin"). EmptyCommit("ensure-master"). EmptyCommit("to-be-added"). // <- this will only exist remotely - PushBranch("origin", "master"). + PushBranchAndSetUpstream("origin", "master"). HardReset("HEAD~1"). NewBranchFrom("base-branch", "master"). EmptyCommit("base-branch-commit"). diff --git a/pkg/integration/tests/branch/reset_to_upstream.go b/pkg/integration/tests/branch/reset_to_upstream.go index c933787e4..3cdbb561d 100644 --- a/pkg/integration/tests/branch/reset_to_upstream.go +++ b/pkg/integration/tests/branch/reset_to_upstream.go @@ -15,10 +15,10 @@ var ResetToUpstream = NewIntegrationTest(NewIntegrationTestArgs{ CloneIntoRemote("origin"). NewBranch("hard-branch"). EmptyCommit("hard commit"). - PushBranch("origin", "hard-branch"). + PushBranchAndSetUpstream("origin", "hard-branch"). NewBranch("soft-branch"). EmptyCommit("soft commit"). - PushBranch("origin", "soft-branch"). + PushBranchAndSetUpstream("origin", "soft-branch"). NewBranch("base"). EmptyCommit("base-branch commit"). CreateFile("file-1", "content").