diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-05-31 18:29:01 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-06-01 10:51:48 +0200 |
commit | 16dceb813baa6a2db14ffc46eef9204f4ddb09d3 (patch) | |
tree | 4237852bb1063e50108a6e454929223b7ce03539 /pkg/integration/tests/branch | |
parent | c70c8e84f85a5ce98c02b305a6dc4ea6a9eb6be8 (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/tests/branch')
-rw-r--r-- | pkg/integration/tests/branch/rebase_abort_on_conflict.go | 49 | ||||
-rw-r--r-- | pkg/integration/tests/branch/rebase_cancel_on_conflict.go | 51 |
2 files changed, 100 insertions, 0 deletions
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"), + ) + }, +}) |