summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/branch/rebase_copied_branch.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/integration/tests/branch/rebase_copied_branch.go')
-rw-r--r--pkg/integration/tests/branch/rebase_copied_branch.go68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkg/integration/tests/branch/rebase_copied_branch.go b/pkg/integration/tests/branch/rebase_copied_branch.go
new file mode 100644
index 000000000..faa31093e
--- /dev/null
+++ b/pkg/integration/tests/branch/rebase_copied_branch.go
@@ -0,0 +1,68 @@
+package branch
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var RebaseCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Make a copy of a branch, rebase it, check that the original branch is unaffected",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ GitVersion: AtLeast("2.38.0"),
+ SetupConfig: func(config *config.AppConfig) {
+ config.AppState.GitLogShowGraph = "never"
+ },
+ SetupRepo: func(shell *Shell) {
+ shell.
+ EmptyCommit("master 1").
+ EmptyCommit("master 2").
+ NewBranchFrom("branch1", "master^").
+ EmptyCommit("branch 1").
+ EmptyCommit("branch 2").
+ NewBranch("branch2")
+
+ shell.SetConfig("rebase.updateRefs", "true")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().Lines(
+ Contains("CI * branch 2"),
+ Contains("CI branch 1"),
+ Contains("CI master 1"),
+ )
+
+ t.Views().Branches().
+ Focus().
+ Lines(
+ Contains("branch2").IsSelected(),
+ Contains("branch1"),
+ Contains("master"),
+ ).
+ NavigateToLine(Contains("master")).
+ Press(keys.Branches.RebaseBranch).
+ Tap(func() {
+ t.ExpectPopup().Menu().
+ Title(Equals("Rebase 'branch2' onto 'master'")).
+ Select(Contains("Simple rebase")).
+ Confirm()
+ })
+
+ t.Views().Commits().Lines(
+ Contains("CI branch 2"),
+ Contains("CI branch 1"),
+ Contains("CI master 2"),
+ Contains("CI master 1"),
+ )
+
+ t.Views().Branches().
+ Focus().
+ NavigateToLine(Contains("branch1")).
+ PressPrimaryAction()
+
+ t.Views().Commits().Lines(
+ Contains("CI branch 2"),
+ Contains("CI branch 1"),
+ Contains("CI master 1"),
+ )
+ },
+})