summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-03-03 19:53:15 +0100
committerStefan Haller <stefan@haller-berlin.de>2023-04-01 08:16:15 +0200
commitb24955063c71f6cb600be8636564144c496fe46a (patch)
treef69ccb28990bca1916464349a7b7459062317ba3 /pkg/integration
parent605bc026a1512d2fddc42fb8f23b9dc1c60440e5 (diff)
Allow rewording the head commit during interactive rebase
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go47
-rw-r--r--pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go47
-rw-r--r--pkg/integration/tests/test_list.go2
3 files changed, 96 insertions, 0 deletions
diff --git a/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go b/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go
new file mode 100644
index 000000000..921e1a016
--- /dev/null
+++ b/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit.go
@@ -0,0 +1,47 @@
+package interactive_rebase
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var RewordYouAreHereCommit = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Rewords the current HEAD commit in an interactive rebase",
+ ExtraCmdArgs: "",
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.
+ CreateNCommits(3)
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().
+ Focus().
+ Lines(
+ Contains("commit 03").IsSelected(),
+ Contains("commit 02"),
+ Contains("commit 01"),
+ ).
+ NavigateToLine(Contains("commit 02")).
+ Press(keys.Universal.Edit).
+ Lines(
+ Contains("commit 03"),
+ Contains("<-- YOU ARE HERE --- commit 02").IsSelected(),
+ Contains("commit 01"),
+ ).
+ Press(keys.Commits.RenameCommit).
+ Tap(func() {
+ t.ExpectPopup().Prompt().
+ Title(Equals("reword commit")).
+ InitialText(Equals("commit 02")).
+ Clear().
+ Type("renamed 02").
+ Confirm()
+ }).
+ Lines(
+ Contains("commit 03"),
+ Contains("<-- YOU ARE HERE --- renamed 02").IsSelected(),
+ Contains("commit 01"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go b/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go
new file mode 100644
index 000000000..c6e57932a
--- /dev/null
+++ b/pkg/integration/tests/interactive_rebase/reword_you_are_here_commit_with_editor.go
@@ -0,0 +1,47 @@
+package interactive_rebase
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var RewordYouAreHereCommitWithEditor = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Rewords the current HEAD commit in an interactive rebase with editor",
+ ExtraCmdArgs: "",
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {
+ },
+ SetupRepo: func(shell *Shell) {
+ shell.
+ CreateNCommits(3).
+ SetConfig("core.editor", "sh -c 'echo renamed 02 >.git/COMMIT_EDITMSG'")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().
+ Focus().
+ Lines(
+ Contains("commit 03").IsSelected(),
+ Contains("commit 02"),
+ Contains("commit 01"),
+ ).
+ NavigateToLine(Contains("commit 02")).
+ Press(keys.Universal.Edit).
+ Lines(
+ Contains("commit 03"),
+ Contains("<-- YOU ARE HERE --- commit 02").IsSelected(),
+ Contains("commit 01"),
+ ).
+ Press(keys.Commits.RenameCommitWithEditor).
+ Tap(func() {
+ t.ExpectPopup().Confirmation().
+ Title(Equals("Reword in editor")).
+ Content(Contains("Are you sure you want to reword this commit in your editor?")).
+ Confirm()
+ }).
+ Lines(
+ Contains("commit 03"),
+ Contains("<-- YOU ARE HERE --- renamed 02").IsSelected(),
+ Contains("commit 01"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index 807c5810d..f0ec4b78c 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -90,6 +90,8 @@ var tests = []*components.IntegrationTest{
interactive_rebase.Rebase,
interactive_rebase.RewordFirstCommit,
interactive_rebase.RewordLastCommit,
+ interactive_rebase.RewordYouAreHereCommit,
+ interactive_rebase.RewordYouAreHereCommitWithEditor,
interactive_rebase.SquashDownFirstCommit,
interactive_rebase.SquashDownSecondCommit,
interactive_rebase.SquashFixupsAboveFirstCommit,