migrate merge conflict undo test

This commit is contained in:
Jesse Duffield 2023-02-19 15:01:57 +11:00
parent a51f64814c
commit 93b9e1bd19
111 changed files with 123 additions and 376 deletions

View file

@ -0,0 +1,34 @@
package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var UndoChooseHunk = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Chooses a hunk when resolving a merge conflict and then undoes the choice",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFileMultiple(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("UU file").IsSelected(),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
Content(Contains("<<<<<<< HEAD\nFirst Change")).
PressPrimaryAction().
// choosing the first hunk
Content(DoesNotContain("<<<<<<< HEAD\nFirst Change")).
Press(keys.Universal.Undo).
Content(Contains("<<<<<<< HEAD\nFirst Change"))
},
})

View file

@ -48,10 +48,96 @@ var MergeConflictsSetup = func(shell *Shell) {
Checkout("first-change-branch") Checkout("first-change-branch")
} }
var CreateMergeCommit = func(shell *Shell) { var CreateMergeConflictFile = func(shell *Shell) {
MergeConflictsSetup(shell) MergeConflictsSetup(shell)
shell.RunShellCommandExpectError("git merge --no-edit second-change-branch") shell.RunShellCommandExpectError("git merge --no-edit second-change-branch")
}
var CreateMergeCommit = func(shell *Shell) {
CreateMergeConflictFile(shell)
shell.UpdateFileAndAdd("file", SecondChangeFileContent) shell.UpdateFileAndAdd("file", SecondChangeFileContent)
shell.ContinueMerge() shell.ContinueMerge()
} }
// These 'multiple' variants are just like the short ones but with longer file contents and with multiple conflicts within the file.
var OriginalFileContentMultiple = `
This
Is
The
Original
File
..
It
Is
Longer
Than
The
Other
Options
`
var FirstChangeFileContentMultiple = `
This
Is
The
First Change
File
..
It
Is
Longer
Than
The
Other
Other First Change
`
var SecondChangeFileContentMultiple = `
This
Is
The
Second Change
File
..
It
Is
Longer
Than
The
Other
Other Second Change
`
// prepares us for a rebase/merge that has conflicts
var MergeConflictsSetupMultiple = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
EmptyCommit("two").
EmptyCommit("three").
CreateFileAndAdd("file", OriginalFileContentMultiple).
Commit("original").
NewBranch("first-change-branch").
UpdateFileAndAdd("file", FirstChangeFileContentMultiple).
Commit("first change").
Checkout("original-branch").
NewBranch("second-change-branch").
UpdateFileAndAdd("file", SecondChangeFileContentMultiple).
Commit("second change").
EmptyCommit("second-change-branch unrelated change").
Checkout("first-change-branch")
}
var CreateMergeConflictFileMultiple = func(shell *Shell) {
MergeConflictsSetupMultiple(shell)
shell.RunShellCommandExpectError("git merge --no-edit second-change-branch")
}
var CreateMergeCommitMultiple = func(shell *Shell) {
CreateMergeConflictFileMultiple(shell)
shell.UpdateFileAndAdd("file", SecondChangeFileContentMultiple)
shell.ContinueMerge()
}

View file

@ -9,6 +9,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/cherry_pick" "github.com/jesseduffield/lazygit/pkg/integration/tests/cherry_pick"
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit" "github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
"github.com/jesseduffield/lazygit/pkg/integration/tests/config" "github.com/jesseduffield/lazygit/pkg/integration/tests/config"
"github.com/jesseduffield/lazygit/pkg/integration/tests/conflicts"
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
"github.com/jesseduffield/lazygit/pkg/integration/tests/diff" "github.com/jesseduffield/lazygit/pkg/integration/tests/diff"
"github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/file"
@ -46,6 +47,7 @@ var tests = []*components.IntegrationTest{
commit.StagedWithoutHooks, commit.StagedWithoutHooks,
commit.Unstaged, commit.Unstaged,
config.RemoteNamedStar, config.RemoteNamedStar,
conflicts.UndoChooseHunk,
custom_commands.Basic, custom_commands.Basic,
custom_commands.FormPrompts, custom_commands.FormPrompts,
custom_commands.MenuFromCommand, custom_commands.MenuFromCommand,

View file

@ -1 +0,0 @@
ref: refs/heads/other_branch

View file

@ -1 +0,0 @@
82db6d0e4502f489719ea0f3dbe7e14413c6d28a

View file

@ -1,9 +0,0 @@
Merge branch 'develop' into other_branch
# Conflicts:
# directory/file
# directory/file2
# file1
# file3
# file4
# file5

View file

@ -1 +0,0 @@
8cd762c119834784fdbf97e9bb3b4c15e804ebaa

View file

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

View file

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

View file

@ -1,7 +0,0 @@
# 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]
# *~
.DS_Store

View file

@ -1,33 +0,0 @@
0000000000000000000000000000000000000000 31f2a971f823279ba1ef877be7599da288f6e24b CI <CI@example.com> 1617671430 +1000 commit (initial): first commit
31f2a971f823279ba1ef877be7599da288f6e24b 31f2a971f823279ba1ef877be7599da288f6e24b CI <CI@example.com> 1617671430 +1000 checkout: moving from master to feature/cherry-picking
31f2a971f823279ba1ef877be7599da288f6e24b 3d1213374cd86b841f034768571d0b5f2c870a16 CI <CI@example.com> 1617671430 +1000 commit: first commit freshman year
3d1213374cd86b841f034768571d0b5f2c870a16 d25721fffa7dc911ff2a9102bef201db225e2f16 CI <CI@example.com> 1617671430 +1000 commit: second commit subway eat fresh
d25721fffa7dc911ff2a9102bef201db225e2f16 dbf5ab9a4fa3f976d266f3be50670aa83121b420 CI <CI@example.com> 1617671430 +1000 commit: third commit fresh
dbf5ab9a4fa3f976d266f3be50670aa83121b420 687ff9526e0d56fafe1445ee4c182a83afc3cc35 CI <CI@example.com> 1617671430 +1000 commit: fourth commit cool
687ff9526e0d56fafe1445ee4c182a83afc3cc35 17dc45dd142947e06cf7e635d62f2c0acbb86da7 CI <CI@example.com> 1617671430 +1000 commit: fifth commit nice
17dc45dd142947e06cf7e635d62f2c0acbb86da7 c27ef6b4964209a875191eca7e56605c8efa5eee CI <CI@example.com> 1617671430 +1000 commit: sixth commit haha
c27ef6b4964209a875191eca7e56605c8efa5eee 5dc2e019349371e9b3e4f1be99754ba70094cad6 CI <CI@example.com> 1617671430 +1000 commit: seventh commit yeah
5dc2e019349371e9b3e4f1be99754ba70094cad6 c50f7e1375a30118c2886d4b31318579f3419231 CI <CI@example.com> 1617671430 +1000 commit: eighth commit woo
c50f7e1375a30118c2886d4b31318579f3419231 c50f7e1375a30118c2886d4b31318579f3419231 CI <CI@example.com> 1617671430 +1000 checkout: moving from feature/cherry-picking to develop
c50f7e1375a30118c2886d4b31318579f3419231 18c07ac9568c564ececb199f78f64babc92214cb CI <CI@example.com> 1617671430 +1000 commit: first commit on develop
18c07ac9568c564ececb199f78f64babc92214cb 31f2a971f823279ba1ef877be7599da288f6e24b CI <CI@example.com> 1617671430 +1000 checkout: moving from develop to master
31f2a971f823279ba1ef877be7599da288f6e24b 442a53c1b023b4816085fdc4eaa85d0c5fd897e2 CI <CI@example.com> 1617671430 +1000 commit: first commit on master
442a53c1b023b4816085fdc4eaa85d0c5fd897e2 18c07ac9568c564ececb199f78f64babc92214cb CI <CI@example.com> 1617671430 +1000 checkout: moving from master to develop
18c07ac9568c564ececb199f78f64babc92214cb 7bc178be031c4645110e9accb4accf16902d2d7f CI <CI@example.com> 1617671430 +1000 commit: second commit on develop
7bc178be031c4645110e9accb4accf16902d2d7f 442a53c1b023b4816085fdc4eaa85d0c5fd897e2 CI <CI@example.com> 1617671430 +1000 checkout: moving from develop to master
442a53c1b023b4816085fdc4eaa85d0c5fd897e2 ced01df5f1a270490c1b9d4efe5ceb0c53626279 CI <CI@example.com> 1617671430 +1000 commit: second commit on master
ced01df5f1a270490c1b9d4efe5ceb0c53626279 7bc178be031c4645110e9accb4accf16902d2d7f CI <CI@example.com> 1617671430 +1000 checkout: moving from master to develop
7bc178be031c4645110e9accb4accf16902d2d7f 6dfbfa4bd19cb38608681df40ebb3a78bd13a824 CI <CI@example.com> 1617671430 +1000 commit: third commit on develop
6dfbfa4bd19cb38608681df40ebb3a78bd13a824 ced01df5f1a270490c1b9d4efe5ceb0c53626279 CI <CI@example.com> 1617671430 +1000 checkout: moving from develop to master
ced01df5f1a270490c1b9d4efe5ceb0c53626279 c9b473bec307b18fd94a913658f4d759be63ca47 CI <CI@example.com> 1617671430 +1000 commit: third commit on master
c9b473bec307b18fd94a913658f4d759be63ca47 6dfbfa4bd19cb38608681df40ebb3a78bd13a824 CI <CI@example.com> 1617671430 +1000 checkout: moving from master to develop
6dfbfa4bd19cb38608681df40ebb3a78bd13a824 82db6d0e4502f489719ea0f3dbe7e14413c6d28a CI <CI@example.com> 1617671430 +1000 commit: fourth commit on develop
82db6d0e4502f489719ea0f3dbe7e14413c6d28a c9b473bec307b18fd94a913658f4d759be63ca47 CI <CI@example.com> 1617671430 +1000 checkout: moving from develop to master
c9b473bec307b18fd94a913658f4d759be63ca47 279f068805e089660f7ddd17ff32f66100e0dca5 CI <CI@example.com> 1617671430 +1000 commit: fourth commit on master
279f068805e089660f7ddd17ff32f66100e0dca5 279f068805e089660f7ddd17ff32f66100e0dca5 CI <CI@example.com> 1617671430 +1000 checkout: moving from master to base_branch
279f068805e089660f7ddd17ff32f66100e0dca5 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 commit: file
08e2576bb7cd0dd9be54f9a523c4bedea0643557 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 checkout: moving from base_branch to other_branch
08e2576bb7cd0dd9be54f9a523c4bedea0643557 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 checkout: moving from other_branch to base_branch
08e2576bb7cd0dd9be54f9a523c4bedea0643557 4e5d3ae0b6e865073bcbd79531a75c55bf7bfcb4 CI <CI@example.com> 1617671430 +1000 commit: file changed
4e5d3ae0b6e865073bcbd79531a75c55bf7bfcb4 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 checkout: moving from base_branch to other_branch
08e2576bb7cd0dd9be54f9a523c4bedea0643557 8cd762c119834784fdbf97e9bb3b4c15e804ebaa CI <CI@example.com> 1617671431 +1000 commit: asd

View file

@ -1,3 +0,0 @@
0000000000000000000000000000000000000000 279f068805e089660f7ddd17ff32f66100e0dca5 CI <CI@example.com> 1617671430 +1000 branch: Created from HEAD
279f068805e089660f7ddd17ff32f66100e0dca5 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 commit: file
08e2576bb7cd0dd9be54f9a523c4bedea0643557 4e5d3ae0b6e865073bcbd79531a75c55bf7bfcb4 CI <CI@example.com> 1617671430 +1000 commit: file changed

View file

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 c50f7e1375a30118c2886d4b31318579f3419231 CI <CI@example.com> 1617671430 +1000 branch: Created from HEAD
c50f7e1375a30118c2886d4b31318579f3419231 18c07ac9568c564ececb199f78f64babc92214cb CI <CI@example.com> 1617671430 +1000 commit: first commit on develop
18c07ac9568c564ececb199f78f64babc92214cb 7bc178be031c4645110e9accb4accf16902d2d7f CI <CI@example.com> 1617671430 +1000 commit: second commit on develop
7bc178be031c4645110e9accb4accf16902d2d7f 6dfbfa4bd19cb38608681df40ebb3a78bd13a824 CI <CI@example.com> 1617671430 +1000 commit: third commit on develop
6dfbfa4bd19cb38608681df40ebb3a78bd13a824 82db6d0e4502f489719ea0f3dbe7e14413c6d28a CI <CI@example.com> 1617671430 +1000 commit: fourth commit on develop

View file

@ -1,9 +0,0 @@
0000000000000000000000000000000000000000 31f2a971f823279ba1ef877be7599da288f6e24b CI <CI@example.com> 1617671430 +1000 branch: Created from HEAD
31f2a971f823279ba1ef877be7599da288f6e24b 3d1213374cd86b841f034768571d0b5f2c870a16 CI <CI@example.com> 1617671430 +1000 commit: first commit freshman year
3d1213374cd86b841f034768571d0b5f2c870a16 d25721fffa7dc911ff2a9102bef201db225e2f16 CI <CI@example.com> 1617671430 +1000 commit: second commit subway eat fresh
d25721fffa7dc911ff2a9102bef201db225e2f16 dbf5ab9a4fa3f976d266f3be50670aa83121b420 CI <CI@example.com> 1617671430 +1000 commit: third commit fresh
dbf5ab9a4fa3f976d266f3be50670aa83121b420 687ff9526e0d56fafe1445ee4c182a83afc3cc35 CI <CI@example.com> 1617671430 +1000 commit: fourth commit cool
687ff9526e0d56fafe1445ee4c182a83afc3cc35 17dc45dd142947e06cf7e635d62f2c0acbb86da7 CI <CI@example.com> 1617671430 +1000 commit: fifth commit nice
17dc45dd142947e06cf7e635d62f2c0acbb86da7 c27ef6b4964209a875191eca7e56605c8efa5eee CI <CI@example.com> 1617671430 +1000 commit: sixth commit haha
c27ef6b4964209a875191eca7e56605c8efa5eee 5dc2e019349371e9b3e4f1be99754ba70094cad6 CI <CI@example.com> 1617671430 +1000 commit: seventh commit yeah
5dc2e019349371e9b3e4f1be99754ba70094cad6 c50f7e1375a30118c2886d4b31318579f3419231 CI <CI@example.com> 1617671430 +1000 commit: eighth commit woo

View file

@ -1,5 +0,0 @@
0000000000000000000000000000000000000000 31f2a971f823279ba1ef877be7599da288f6e24b CI <CI@example.com> 1617671430 +1000 commit (initial): first commit
31f2a971f823279ba1ef877be7599da288f6e24b 442a53c1b023b4816085fdc4eaa85d0c5fd897e2 CI <CI@example.com> 1617671430 +1000 commit: first commit on master
442a53c1b023b4816085fdc4eaa85d0c5fd897e2 ced01df5f1a270490c1b9d4efe5ceb0c53626279 CI <CI@example.com> 1617671430 +1000 commit: second commit on master
ced01df5f1a270490c1b9d4efe5ceb0c53626279 c9b473bec307b18fd94a913658f4d759be63ca47 CI <CI@example.com> 1617671430 +1000 commit: third commit on master
c9b473bec307b18fd94a913658f4d759be63ca47 279f068805e089660f7ddd17ff32f66100e0dca5 CI <CI@example.com> 1617671430 +1000 commit: fourth commit on master

View file

@ -1,2 +0,0 @@
0000000000000000000000000000000000000000 08e2576bb7cd0dd9be54f9a523c4bedea0643557 CI <CI@example.com> 1617671430 +1000 branch: Created from HEAD
08e2576bb7cd0dd9be54f9a523c4bedea0643557 8cd762c119834784fdbf97e9bb3b4c15e804ebaa CI <CI@example.com> 1617671431 +1000 commit: asd

View file

@ -1,3 +0,0 @@
x<01><>A
Β0E]η³$c<>¤΅«c2™PΑ4%¦ΰρ-x·<><C2B7>ψ<EFBFBD>k)ΟWΤ§ήDΐXφ<1D>δΰΖΜa@Ξθ5iΔL#Ε,)ENj£&kΡz<>φΗ<>¥€ΖΙ!<21>3LΦ+ΪϋRL3ά¦ω!*ΫK.\Λ<1D>;ο<Z£α<C2A3>ZkuΠ#<23>Λ<EFBFBD>s•λήϊ? κ
…ή‡­ΎN¶A]

View file

@ -1,2 +0,0 @@
xå<>A
Â0E]çÿAîTz<>I34…˜´âíM‰Kîý0 |>oñ\‡ãa¿ë83ÆBQÉ/h E Çœ }­²Ìa¨ŸAsjAw¿ÞŒ¤ž1O*Bǯ³Š|V¡'5çßC/ƒ¹´ÀóÂQ&c­ý«Û¬5Éêx³ÜÏüâ7Ã0|Æ

View file

@ -1,2 +0,0 @@
x<01><>K
Т@ @]Я)В<64><D19E><EFBFBD>аU<D0B0><55>ж N[к<О/ріёМqЉujр-<2D>к&I<>ФDe<44><65>ЩyЕJ<D095><63>1!<21>Цт5<D182><35>7<EFBFBD>Ї<> <09>Р<0E><>шСОЭту`јн<D198>Ы]зЎПЫ<D09F>ыњ<D18B>ЫИдИь0Ѓ<30>СТйYkЭA<D0AD>Љ&ъFЇmo№Ћ`<60>Ёђ~Фц аб?

View file

@ -1,2 +0,0 @@
x<01>ÎM
Â0@a×9Å왤“L"BW=F2™Øý¡Dðøönßâɶ,s㥪P-áʹgbîŦRcÒ¬äU9.êÌž]`¯ÎsÈ™¥`)1«§“{× e-š0Pç=ôiÓvÀ0Â}ŸúMËþÖØR‡pµˆhÎzN5ý“:¿dJëKùœ‘=

View file

@ -1 +0,0 @@
xå<>Ñ €0CývŠLÐÅ\ãj<C3A3>VО´WÄí=Àü<08>„äãùM<†iìf.ŒµPUÊM¤HTá™3T¶`Q¢9ƒ"×^òÂh‡d[éºóÓØËi+B<>Ø;ç~¥/ Y:/¸<PÃ

View file

@ -1,2 +0,0 @@
x<01>ŽA
Â0E]ç³d&“D„®<Æ$™PÁØR£èí x·<>ÿø/-µ^¤]ÛD #añÆ<C3B1>×.±s­]88rbÔsaP+oro<72>Œ—BѲ<03>Þé G„.<2E>R؉ˆâg— ¦ §ËYÞ\×ÒRO Iûþg„½FDÕi<C395>jòç\=äÕ[føyðžÕô,?w

View file

@ -1,3 +0,0 @@
x<01>ŽM
Â0F]ç³d¦I3D„®zŒüLh¡1%Dñø¼€oñx¾XKY; „§ÞDÀ<44>.±'LžÉÇì8kÄ`Ðë`²F‡ZÐEµû&Ï"ñ5jŠÆšÅùƒ9&“u8¤!qVþÕ—Ú`šá6Íùø²or‰µÜ<C2B5>,±e2áLˆ¨zœêò§®ú²¶¿
ê¼e«»ú<02>8@N

View file

@ -1,3 +0,0 @@
x<01>ŽA
à E»ö³/'ŠN ”BV9†£#)$1ˆ)=~…^ ÛÿÞƒ˶½ ˆ—VE@B°Å$ë˜R¶žS,É8â }Œ&©#TÙ¸”9Ë ÇȆœ&GØ -Ì&xêÀ¬
g[J…i†û4?å¶c•[,ÛСw­ÑpE­µêk?ÕäO]årÖ¶À/ƒ²C·¬åP_ÔTB

View file

@ -1,2 +0,0 @@
x<01>ŽA
Â0E]ç³d&M“D„®zŒÉtŠiJÁãð.ÿç=þ—’ó³‚%<Õ]p<>¤Q|  èÙS >…ä±kѦ¥“>ö³Ùx×µsûN(¡íä1öË,N™…ÒBZÃïú(;Œ\Çé®ÎÛK/Rò ÈShƒ®C8"šÖ¶SUÿÄÍ¡RÖ~2Í6_z1@

View file

@ -1,3 +0,0 @@
x<01>ŽA
Â0E]ç³dfÚ$D„®zŒdfBkKŒàñ-xwŸÇ{ðe]{F ôœ¢xTI¹çÌ9°y‰QTL,0j7„>kï¶TíÙ@ÙG¦RJŠ*í‹Ó@ÈÙ
#iföÆ…Kï6¯Æ .ãt³OZ¶‡<C2B6>d]®@<40>bˆÔwGBD·ÓýT³?u׿{UøUPª½f÷>‰?§

View file

@ -1 +0,0 @@
xĺ<>Ń €0Cýî™ ?Š3¸ĆµV¨=iOÄí=Ŕü<08>„äă…,ý8tWĆÚ@h*ő‚&R$jĚ*y¶¨Ęs-Üś”Č8v)¶Ňuă§±—ÓV„HęĽ÷żŇ<17>"ťË µćPż

View file

@ -1 +0,0 @@
4e5d3ae0b6e865073bcbd79531a75c55bf7bfcb4

View file

@ -1 +0,0 @@
82db6d0e4502f489719ea0f3dbe7e14413c6d28a

View file

@ -1 +0,0 @@
c50f7e1375a30118c2886d4b31318579f3419231

View file

@ -1 +0,0 @@
279f068805e089660f7ddd17ff32f66100e0dca5

View file

@ -1 +0,0 @@
8cd762c119834784fdbf97e9bb3b4c15e804ebaa

View file

@ -1 +0,0 @@
this is file number 1 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 2 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 3 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 4 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 5 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 6 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 7 that I'm going to cherry-pick

View file

@ -1 +0,0 @@
this is file number 8 that I'm going to cherry-pick

Some files were not shown because too many files have changed in this diff Show more