1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

migrate merge conflict tests

This commit is contained in:
Jesse Duffield
2023-02-25 22:09:14 +11:00
parent 33f9f81c8c
commit ff3c5d331e
247 changed files with 156 additions and 912 deletions

View File

@ -60,6 +60,33 @@ var CreateMergeCommit = func(shell *Shell) {
shell.ContinueMerge()
}
// creates a merge conflict where there are two files with conflicts and a separate file without conflicts
var CreateMergeConflictFiles = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
EmptyCommit("two").
EmptyCommit("three").
CreateFileAndAdd("file1", OriginalFileContent).
CreateFileAndAdd("file2", OriginalFileContent).
Commit("original").
NewBranch("first-change-branch").
UpdateFileAndAdd("file1", FirstChangeFileContent).
UpdateFileAndAdd("file2", FirstChangeFileContent).
Commit("first change").
Checkout("original-branch").
NewBranch("second-change-branch").
UpdateFileAndAdd("file1", SecondChangeFileContent).
UpdateFileAndAdd("file2", SecondChangeFileContent).
// this file is not changed in the second branch
CreateFileAndAdd("file3", "content").
Commit("second change").
EmptyCommit("second-change-branch unrelated change").
Checkout("first-change-branch")
shell.RunShellCommandExpectError("git merge --no-edit second-change-branch")
}
// These 'multiple' variants are just like the short ones but with longer file contents and with multiple conflicts within the file.
var OriginalFileContentMultiple = `
@ -110,8 +137,7 @@ Other
Other Second Change
`
// prepares us for a rebase/merge that has conflicts
var MergeConflictsSetupMultiple = func(shell *Shell) {
var CreateMergeConflictFileMultiple = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
@ -128,16 +154,6 @@ var MergeConflictsSetupMultiple = func(shell *Shell) {
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()
}