1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-25 17:41:56 +03: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<01><>K
<EFBFBD>@]<5D>)z/H<>g<EFBFBD>ɀ<EFBFBD><C980>U<EFBFBD>љ<EFBFBD>A<EFBFBD>|<13><><06><><EFBFBD>WT<57>K<EFBFBD>4= ק<><01>YR<59><52><04>-1 l<>R46<34><01><><EFBFBD>9<><39>V<EFBFBD>02<>A|#<23>8<EFBFBD>[-:<06>q<EFBFBD>c"xh<18>J<EFBFBD><4A><EFBFBD>X6<58>z<EFBFBD>v<EFBFBD><1F><>.i<>nT<6E>J+<2B><>Hgfw<66><77>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD> +<2B><06><><EFBFBD> <0B><>?>

View File

@ -0,0 +1 @@
x<01><><EFBFBD>j1ES<45>W<EFBFBD>s<12>3<EFBFBD>Y B0<42>r<EFBFBD><72><EFBFBD>]<5D><06>!<21>|~<16><><>9<EFBFBD><39><EFBFBD><EFBFBD>9<EFBFBD><39><EFBFBD>U<EFBFBD><55>'<27>"c`V<>Px-<2D>`<60>|1<><31>|<7C><>mZ<6D>4<EFBFBD><34><EFBFBD><04>HI}<02>@<40><>R<EFBFBD>hG<04><>I{<7B><>i<>F<EFBFBD>y <20><><EFBFBD>J?zf2s$<14><><EFBFBD><EFBFBD>]<5D><>Ng<4E>v:<1F><><EFBFBD><76><C3AB><EFBFBD><EFBFBD>E(sJ<73>ٓ<EFBFBD>ݾ<EFBFBD>

View File

@ -0,0 +1,2 @@
x<01><>K
<EFBFBD>0@]<5D><14>$<24><><17>]<5D><18>8`<60>1<EFBFBD>D<EFBFBD><44>

View File

@ -0,0 +1 @@
77e1bb1effc5857c4d701219a001823432e3586d

View File

@ -0,0 +1 @@
5e62a9dc2e1352e7ee6ecf17033e2ed3382efc6f