1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00

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
pkg/integration/tests
test/integration/mergeConflictUndo/expected/repo
.git_keep
COMMIT_EDITMSGFETCH_HEADHEADMERGE_HEADMERGE_MODEMERGE_MSGORIG_HEADconfigdescriptionindex
info
logs
objects
08
09
17
18
1b
20
21
22
24
27
2e
31
32
34
36
38
3d
44
4e
4f
5d
5f
60
61
68
6d
78
7b
82
88
8c
90
91
95
9d
a5
af
b4
c1
c2
c5
c9
ce
d0
d2
d8
da
db
dc
df
e3
e4
ea
eb
f1
f3
fd
refs/heads
cherrypicking1cherrypicking2cherrypicking3cherrypicking4cherrypicking5cherrypicking6cherrypicking7cherrypicking8

@ -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"))
},
})

@ -48,10 +48,96 @@ var MergeConflictsSetup = func(shell *Shell) {
Checkout("first-change-branch")
}
var CreateMergeCommit = func(shell *Shell) {
var CreateMergeConflictFile = func(shell *Shell) {
MergeConflictsSetup(shell)
shell.RunShellCommandExpectError("git merge --no-edit second-change-branch")
}
var CreateMergeCommit = func(shell *Shell) {
CreateMergeConflictFile(shell)
shell.UpdateFileAndAdd("file", SecondChangeFileContent)
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()
}

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

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

@ -1 +0,0 @@
82db6d0e4502f489719ea0f3dbe7e14413c6d28a

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

@ -1 +0,0 @@
8cd762c119834784fdbf97e9bb3b4c15e804ebaa

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

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

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

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

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

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

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

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

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

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

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

@ -1,2 +0,0 @@
x��K
Т@ @]Я)Вdў���аU��ж N[к<О/ріёМqЉujр-�к&I�ФDe��ЩyЕJ�cЁ�1!�Цт5��7�Ї� �<вРNД ��шСОЭту`јн�Ы]зЎПЫ�ыњ�ЫИдИь0Ѓ�СТйYkЭA�Љ&ъFЇmo№Ћ`�Ёђ~Фц аб?

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

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

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

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

@ -1,3 +0,0 @@
x�Ž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

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

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

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

@ -1 +0,0 @@
4e5d3ae0b6e865073bcbd79531a75c55bf7bfcb4

@ -1 +0,0 @@
82db6d0e4502f489719ea0f3dbe7e14413c6d28a

@ -1 +0,0 @@
279f068805e089660f7ddd17ff32f66100e0dca5

@ -1 +0,0 @@
8cd762c119834784fdbf97e9bb3b4c15e804ebaa

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

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

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

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

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

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

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

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