Skip to content

Commit 50b2aa5

Browse files
committed
Add test for rewording a merge commit
This currently fails with an error.
1 parent b02441c commit 50b2aa5

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package interactive_rebase
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var RewordMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Rewords a merge commit which is not the current head commit",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {
14+
shell.
15+
EmptyCommit("base").
16+
NewBranch("first-branch").
17+
CreateFileAndAdd("file1.txt", "content").
18+
Commit("one").
19+
Checkout("master").
20+
Merge("first-branch").
21+
NewBranch("second-branch").
22+
EmptyCommit("two")
23+
},
24+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
25+
t.Views().Commits().
26+
Focus().
27+
Lines(
28+
Contains("CI ◯ two").IsSelected(),
29+
Contains("CI ⏣─╮ Merge branch 'first-branch'"),
30+
Contains("CI │ ◯ one"),
31+
Contains("CI ◯─╯ base"),
32+
).
33+
SelectNextItem().
34+
Press(keys.Commits.RenameCommit).
35+
Tap(func() {
36+
t.ExpectPopup().CommitMessagePanel().
37+
Title(Equals("Reword commit")).
38+
InitialText(Equals("Merge branch 'first-branch'")).
39+
Clear().
40+
Type("renamed merge").
41+
Confirm()
42+
}).
43+
/* EXPECTED:
44+
Lines(
45+
Contains("CI ◯ two"),
46+
Contains("CI ⏣─╮ renamed merge").IsSelected(),
47+
Contains("CI │ ◯ one"),
48+
Contains("CI ◯ ╯ base"),
49+
)
50+
ACTUAL: */
51+
Tap(func() {
52+
t.ExpectPopup().Alert().Title(Equals("Error")).
53+
Content(Contains("error: 'edit' does not accept merge commits"))
54+
})
55+
},
56+
})

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ var tests = []*components.IntegrationTest{
275275
interactive_rebase.RewordFirstCommit,
276276
interactive_rebase.RewordLastCommit,
277277
interactive_rebase.RewordLastCommitOfStackedBranch,
278+
interactive_rebase.RewordMergeCommit,
278279
interactive_rebase.RewordYouAreHereCommit,
279280
interactive_rebase.RewordYouAreHereCommitWithEditor,
280281
interactive_rebase.ShowExecTodos,

0 commit comments

Comments
 (0)