mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
migrate merge conflict undo test
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user