mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-23 00:39:13 +02:00
Add test for amending a merge commit
This commit is contained in:
@ -64,7 +64,7 @@ func (s *Shell) Checkout(name string) *Shell {
|
||||
}
|
||||
|
||||
func (s *Shell) Merge(name string) *Shell {
|
||||
return s.RunCommand("git merge --commit " + name)
|
||||
return s.RunCommand("git merge --commit --no-ff " + name)
|
||||
}
|
||||
|
||||
func (s *Shell) GitAdd(path string) *Shell {
|
||||
|
37
pkg/integration/tests/interactive_rebase/amend_merge.go
Normal file
37
pkg/integration/tests/interactive_rebase/amend_merge.go
Normal file
@ -0,0 +1,37 @@
|
||||
package interactive_rebase
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Amends a staged file to a merge commit.",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
NewBranch("development-branch").
|
||||
CreateFileAndAdd("initial-file", "content").
|
||||
Commit("initial commit").
|
||||
NewBranch("feature-branch"). // it's also checked out automatically
|
||||
CreateFileAndAdd("new-feature-file", "new content").
|
||||
Commit("new feature commit").
|
||||
CheckoutBranch("development-branch").
|
||||
Merge("feature-branch").
|
||||
CreateFileAndAdd("post-merge-file", "content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(3)
|
||||
|
||||
input.SwitchToCommitsWindow()
|
||||
assert.CurrentViewName("commits")
|
||||
|
||||
input.PressKeys(keys.Commits.AmendToCommit)
|
||||
input.PressKeys(keys.Universal.Return)
|
||||
|
||||
assert.MatchHeadCommitMessage(Contains("Merge"))
|
||||
assert.CommitCount(3)
|
||||
},
|
||||
})
|
@ -29,6 +29,7 @@ var tests = []*components.IntegrationTest{
|
||||
branch.Rebase,
|
||||
branch.RebaseAndDrop,
|
||||
interactive_rebase.One,
|
||||
interactive_rebase.AmendMerge,
|
||||
custom_commands.Basic,
|
||||
custom_commands.MultiplePrompts,
|
||||
custom_commands.MenuFromCommand,
|
||||
|
@ -0,0 +1 @@
|
||||
new feature commit
|
@ -0,0 +1 @@
|
||||
ref: refs/heads/development-branch
|
@ -0,0 +1 @@
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c
|
@ -0,0 +1,10 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
||||
[commit]
|
||||
gpgSign = false
|
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
@ -0,0 +1,5 @@
|
||||
0000000000000000000000000000000000000000 a69464e3729a09e3a526d4a2db209ee43e64ba1c CI <CI@example.com> 1662823399 +0200 commit (initial): initial commit
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c a69464e3729a09e3a526d4a2db209ee43e64ba1c CI <CI@example.com> 1662823399 +0200 checkout: moving from development-branch to feature-branch
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c 5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f CI <CI@example.com> 1662823399 +0200 commit: new feature commit
|
||||
5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f a69464e3729a09e3a526d4a2db209ee43e64ba1c CI <CI@example.com> 1662823399 +0200 checkout: moving from feature-branch to development-branch
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c 77e1bb1effc5857c4d701219a001823432e3586d CI <CI@example.com> 1662823399 +0200 merge feature-branch: Merge made by the 'ort' strategy.
|
@ -0,0 +1,2 @@
|
||||
0000000000000000000000000000000000000000 a69464e3729a09e3a526d4a2db209ee43e64ba1c CI <CI@example.com> 1662823399 +0200 commit (initial): initial commit
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c 77e1bb1effc5857c4d701219a001823432e3586d CI <CI@example.com> 1662823399 +0200 merge feature-branch: Merge made by the 'ort' strategy.
|
@ -0,0 +1,2 @@
|
||||
0000000000000000000000000000000000000000 a69464e3729a09e3a526d4a2db209ee43e64ba1c CI <CI@example.com> 1662823399 +0200 branch: Created from HEAD
|
||||
a69464e3729a09e3a526d4a2db209ee43e64ba1c 5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f CI <CI@example.com> 1662823399 +0200 commit: new feature commit
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
x��K
|
||||
�@]�)z/H�g�ɀ��U�љ�A�|�����WT�K�4= ק��YR���-1l�R46����9��V�02�A|#�8�[-:�q�c"xh�J���X6�z�v���.i�nT�J+��Hgfw��T������+������?>
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
x���j1ES�W�s�3�Y B0�r���]��!�|~��)Ͻ�9����9���U��'�"c`V�Px-�`�|1��|��mZ�4����HI}�@��R�hG��I{��i�F�y ���J?zf2s$����]��Ng�v:���vë����E(sJ�ٓ�ݾ�
|
@ -0,0 +1,2 @@
|
||||
x��K
|
||||
�0@]��$���]��8`�1�D��
|
@ -0,0 +1 @@
|
||||
77e1bb1effc5857c4d701219a001823432e3586d
|
@ -0,0 +1 @@
|
||||
5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f
|
@ -0,0 +1 @@
|
||||
content
|
@ -0,0 +1 @@
|
||||
new content
|
@ -0,0 +1 @@
|
||||
content
|
Reference in New Issue
Block a user