1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +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

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")
}
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()
}

View File

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

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��A
�0E]��$cҤ��c2�P�4%���-x�����k)�Wԧ�D�X������a@��5i�L#�,)ENj�&k�z���ǜ����
c��!�3L�+��RL3ܦ�!*�K.\��;�<Z���Zku�#�˟s����?

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��K
�@ @]�)�d�����U��� N[�<�/����q�uj�-��&I��De���y�J�c��1!���5��7��� �<��N� ��������`�ݞ�]׮�ˇ���˸���0�����Yk�A��&�F�mo��`���~�� ��?

View File

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

View File

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

View File

@ -1,2 +0,0 @@
x��A
�0E]��d�&�D��<�$�P��R���

View File

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

View File

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

View File

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

View File

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

View File

@ -1 +0,0 @@
x��� �0C����?�3�ƵV�=iO��=�������,�8tW��@h*��&R$j�*y��ʑs-ܜ��8v)��u㧱��V�H������"��

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