1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

Add test for amending a merge commit

This commit is contained in:
Luka Markušić 2022-09-10 17:00:40 +02:00
parent 4c7d363959
commit 0141bbde0e
26 changed files with 78 additions and 1 deletions

View File

@ -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 {

View 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)
},
})

View File

@ -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,

View File

@ -0,0 +1 @@
ref: refs/heads/development-branch

View File

@ -0,0 +1 @@
a69464e3729a09e3a526d4a2db209ee43e64ba1c

View File

@ -0,0 +1,10 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -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]
# *~

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -0,0 +1,2 @@
x��K
Β@]Ο)z/H§g�Ι€��U�Ρ™ΌAΑ|τψΌ€ΛWTΑKΛ4= Χ§²δYRΚΪο-1 lΉR46¶�“µ9ΛθVΫ02�A|#Ρ8Β[-:“q�c"xh¬JΞφςX6κzΊvύ›Φ.i™nT©J+ήΗHgfwΠγTΑ�Ί›ρ¦ +ϋϊµξ ήή?>

View File

@ -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îÙ“÷ݾî ÿÔ»ÔO¸©êbw(Ðv¯xù჻.muÜÖmÞ�î«ÐZ0

View File

@ -0,0 +1,2 @@
x██K
б0@]ГЁ$⌠и╓]УИ8`═1╔DХЯ x╥▐Вxэj-пя╔"`c"▐б Q╟▌яeФDиIa╣OkWTЧТW;`^Ю>/9sщ7╧q╚═В&▌<%╦jё╣tL╨Э╘╚Р.╫Д ~²ЗЭ.ц

View File

@ -0,0 +1 @@
77e1bb1effc5857c4d701219a001823432e3586d

View File

@ -0,0 +1 @@
5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f