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:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user