2022-12-28 08:52:04 +02:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
var RenameBranchAndPull = NewIntegrationTest(NewIntegrationTestArgs{
|
|
|
|
Description: "Rename a branch to no longer match its upstream, then pull from the upstream",
|
2023-05-21 09:00:29 +02:00
|
|
|
ExtraCmdArgs: []string{},
|
2022-12-28 08:52:04 +02:00
|
|
|
Skip: false,
|
2023-02-19 04:51:34 +02:00
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
2022-12-28 08:52:04 +02:00
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.EmptyCommit("one")
|
|
|
|
shell.EmptyCommit("two")
|
|
|
|
|
|
|
|
shell.CloneIntoRemote("origin")
|
|
|
|
shell.SetBranchUpstream("master", "origin/master")
|
|
|
|
|
|
|
|
// remove the 'two' commit so that we have something to pull from the remote
|
|
|
|
shell.HardReset("HEAD^")
|
|
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
|
|
t.Views().Commits().
|
|
|
|
Lines(
|
|
|
|
Contains("one"),
|
|
|
|
)
|
|
|
|
|
|
|
|
t.Views().Branches().
|
|
|
|
Focus().
|
|
|
|
Lines(
|
|
|
|
Contains("master"),
|
|
|
|
).
|
|
|
|
Press(keys.Branches.RenameBranch).
|
|
|
|
Tap(func() {
|
|
|
|
t.ExpectPopup().Confirmation().
|
2023-05-25 13:11:51 +02:00
|
|
|
Title(Equals("Rename branch")).
|
2022-12-28 08:52:04 +02:00
|
|
|
Content(Equals("This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?")).
|
|
|
|
Confirm()
|
|
|
|
|
|
|
|
t.ExpectPopup().Prompt().
|
|
|
|
Title(Contains("Enter new branch name")).
|
|
|
|
InitialText(Equals("master")).
|
|
|
|
Type("-local").
|
|
|
|
Confirm()
|
|
|
|
}).
|
2023-02-19 02:42:00 +02:00
|
|
|
Press(keys.Universal.Pull)
|
2022-12-28 08:52:04 +02:00
|
|
|
|
|
|
|
t.Views().Commits().
|
|
|
|
Lines(
|
|
|
|
Contains("two"),
|
|
|
|
Contains("one"),
|
|
|
|
)
|
|
|
|
},
|
|
|
|
})
|