1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-21 12:16:54 +02:00

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.
This commit is contained in:
Stefan Haller 2024-05-17 21:08:53 +02:00
parent 6afcc5bda8
commit c4927e21c5
5 changed files with 7 additions and 7 deletions

View File

@ -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}) 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}) return self.RunCommand([]string{"git", "push", "--set-upstream", upstream, branch})
} }

View File

@ -15,9 +15,9 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin"). CloneIntoRemote("origin").
EmptyCommit("blah"). EmptyCommit("blah").
NewBranch("branch-one"). NewBranch("branch-one").
PushBranch("origin", "branch-one"). PushBranchAndSetUpstream("origin", "branch-one").
NewBranch("branch-two"). NewBranch("branch-two").
PushBranch("origin", "branch-two"). PushBranchAndSetUpstream("origin", "branch-two").
EmptyCommit("deletion blocker"). EmptyCommit("deletion blocker").
NewBranch("branch-three") NewBranch("branch-three")
}, },

View File

@ -18,7 +18,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe
shell.NewBranch("mybranch") 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. // 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. // This is not easy to do in a cross-platform way, nor is it easy to do in a docker container.

View File

@ -15,7 +15,7 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin"). CloneIntoRemote("origin").
EmptyCommit("ensure-master"). EmptyCommit("ensure-master").
EmptyCommit("to-be-added"). // <- this will only exist remotely EmptyCommit("to-be-added"). // <- this will only exist remotely
PushBranch("origin", "master"). PushBranchAndSetUpstream("origin", "master").
HardReset("HEAD~1"). HardReset("HEAD~1").
NewBranchFrom("base-branch", "master"). NewBranchFrom("base-branch", "master").
EmptyCommit("base-branch-commit"). EmptyCommit("base-branch-commit").

View File

@ -15,10 +15,10 @@ var ResetToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin"). CloneIntoRemote("origin").
NewBranch("hard-branch"). NewBranch("hard-branch").
EmptyCommit("hard commit"). EmptyCommit("hard commit").
PushBranch("origin", "hard-branch"). PushBranchAndSetUpstream("origin", "hard-branch").
NewBranch("soft-branch"). NewBranch("soft-branch").
EmptyCommit("soft commit"). EmptyCommit("soft commit").
PushBranch("origin", "soft-branch"). PushBranchAndSetUpstream("origin", "soft-branch").
NewBranch("base"). NewBranch("base").
EmptyCommit("base-branch commit"). EmptyCommit("base-branch commit").
CreateFile("file-1", "content"). CreateFile("file-1", "content").