-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
amend_commit_with_conflict.go
74 lines (67 loc) · 1.84 KB
/
amend_commit_with_conflict.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AmendCommitWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to a commit, causing a conflict there.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file", "1\n").Commit("one")
shell.UpdateFileAndAdd("file", "1\n2\n").Commit("two")
shell.UpdateFileAndAdd("file", "1\n2\n3\n").Commit("three")
shell.UpdateFileAndAdd("file", "1\n2\n4\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("three"),
Contains("two"),
Contains("one"),
).
NavigateToLine(Contains("two")).
Press(keys.Commits.AmendToCommit).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Amend commit")).
Content(Contains("Are you sure you want to amend this commit with your staged files?")).
Confirm()
t.Common().AcknowledgeConflicts()
}).
Lines(
Contains("pick").Contains("three"),
Contains("conflict").Contains("<-- YOU ARE HERE --- fixup! two"),
Contains("two"),
Contains("one"),
)
t.Views().Files().
IsFocused().
Lines(
Contains("UU file"),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
TopLines(
Contains("1"),
Contains("2"),
Contains("<<<<<<< HEAD"),
Contains("======="),
Contains("4"),
Contains(">>>>>>>"),
).
SelectNextItem().
PressPrimaryAction() // pick "4"
t.Common().ContinueOnConflictsResolved()
t.Common().AcknowledgeConflicts()
t.Views().Commits().
Lines(
Contains("<-- YOU ARE HERE --- three"),
Contains("two"),
Contains("one"),
)
},
})