summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-05-31 18:29:01 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-06-01 10:51:48 +0200
commit16dceb813baa6a2db14ffc46eef9204f4ddb09d3 (patch)
tree4237852bb1063e50108a6e454929223b7ce03539 /pkg/integration
parentc70c8e84f85a5ce98c02b305a6dc4ea6a9eb6be8 (diff)
Show menu instead of prompt when there are conflicts in a rebase or merge
This solves the issue that previously you could too easily abort a rebase accidentally by hitting escape.
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/components/common.go6
-rw-r--r--pkg/integration/tests/branch/rebase_abort_on_conflict.go49
-rw-r--r--pkg/integration/tests/branch/rebase_cancel_on_conflict.go51
-rw-r--r--pkg/integration/tests/test_list.go2
4 files changed, 105 insertions, 3 deletions
diff --git a/pkg/integration/components/common.go b/pkg/integration/components/common.go
index 0f2e3b871..fe81438ee 100644
--- a/pkg/integration/components/common.go
+++ b/pkg/integration/components/common.go
@@ -19,9 +19,9 @@ func (self *Common) ContinueRebase() {
}
func (self *Common) AcknowledgeConflicts() {
- self.t.ExpectPopup().Confirmation().
- Title(Equals("Auto-merge failed")).
- Content(Contains("Conflicts!")).
+ self.t.ExpectPopup().Menu().
+ Title(Equals("Conflicts!")).
+ Select(Contains("View conflicts")).
Confirm()
}
diff --git a/pkg/integration/tests/branch/rebase_abort_on_conflict.go b/pkg/integration/tests/branch/rebase_abort_on_conflict.go
new file mode 100644
index 000000000..4eba77627
--- /dev/null
+++ b/pkg/integration/tests/branch/rebase_abort_on_conflict.go
@@ -0,0 +1,49 @@
+package branch
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+ "github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
+)
+
+var RebaseAbortOnConflict = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Rebase onto another branch, abort when there are conflicts.",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shared.MergeConflictsSetup(shell)
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().TopLines(
+ Contains("first change"),
+ Contains("original"),
+ )
+
+ t.Views().Branches().
+ Focus().
+ Lines(
+ Contains("first-change-branch"),
+ Contains("second-change-branch"),
+ Contains("original-branch"),
+ ).
+ SelectNextItem().
+ Press(keys.Branches.RebaseBranch)
+
+ t.ExpectPopup().Menu().
+ Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Select(Contains("Simple rebase")).
+ Confirm()
+
+ t.ExpectPopup().Menu().
+ Title(Equals("Conflicts!")).
+ Select(Contains("Abort the rebase")).
+ Confirm()
+
+ t.Views().Branches().
+ IsFocused()
+
+ t.Views().Files().
+ IsEmpty()
+ },
+})
diff --git a/pkg/integration/tests/branch/rebase_cancel_on_conflict.go b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
new file mode 100644
index 000000000..23b7661b2
--- /dev/null
+++ b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
@@ -0,0 +1,51 @@
+package branch
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+ "github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
+)
+
+var RebaseCancelOnConflict = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Rebase onto another branch, cancel when there are conflicts.",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shared.MergeConflictsSetup(shell)
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().TopLines(
+ Contains("first change"),
+ Contains("original"),
+ )
+
+ t.Views().Branches().
+ Focus().
+ Lines(
+ Contains("first-change-branch"),
+ Contains("second-change-branch"),
+ Contains("original-branch"),
+ ).
+ SelectNextItem().
+ Press(keys.Branches.RebaseBranch)
+
+ t.ExpectPopup().Menu().
+ Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Select(Contains("Simple rebase")).
+ Confirm()
+
+ t.ExpectPopup().Menu().
+ Title(Equals("Conflicts!")).
+ Select(Contains("Abort the rebase")).
+ Cancel()
+
+ t.Views().Branches().
+ IsFocused()
+
+ t.Views().Files().
+ Lines(
+ Contains("UU file"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index 50377f101..2a16df041 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -36,7 +36,9 @@ var tests = []*components.IntegrationTest{
branch.DetachedHead,
branch.OpenWithCliArg,
branch.Rebase,
+ branch.RebaseAbortOnConflict,
branch.RebaseAndDrop,
+ branch.RebaseCancelOnConflict,
branch.RebaseDoesNotAutosquash,
branch.Reset,
branch.ResetUpstream,