Documentation
¶
Index ¶
Constants ¶
const CustomConflictMarkerSize = 32
A conflict-marker-size that isn't git's default of 7. It's set for file types whose regular content tends to contain marker-looking lines, e.g. documentation about merging, or test scripts.
Variables ¶
var CreateMergeCommit = func(shell *Shell) { CreateMergeConflictFile(shell) shell.UpdateFileAndAdd("file", SecondChangeFileContent) shell.ContinueMerge() }
var CreateMergeConflictFile = func(shell *Shell) { MergeConflictsSetup(shell) shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"}) }
var CreateMergeConflictFileForMergeFileTests = func(shell *Shell, originalFileContent string, currentChangeFileContent string, incomingChangeFileContent string) { shell. NewBranch("original-branch"). EmptyCommit("one"). CreateFileAndAdd("file", originalFileContent). Commit("original"). NewBranch("current-change-branch"). UpdateFileAndAdd("file", currentChangeFileContent). Commit("first change"). Checkout("original-branch"). NewBranch("incoming-change-branch"). UpdateFileAndAdd("file", incomingChangeFileContent). Commit("second change"). Checkout("current-change-branch"). RunCommandExpectError([]string{"git", "merge", "--no-edit", "incoming-change-branch"}) }
var CreateMergeConflictFileMultiple = 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") shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"}) }
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). CreateFileAndAdd("file3", "content"). Commit("second change"). EmptyCommit("second-change-branch unrelated change"). Checkout("first-change-branch") shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"}) }
creates a merge conflict where there are two files with conflicts and a separate file without conflicts
var FirstChangeFileContent = `
This
Is
The
First Change
File
`
var FirstChangeFileContentMultiple = `
This
Is
The
First Change
File
..
It
Is
Longer
Than
The
Other
Other First Change
`
var MergeConflictsSetup = func(shell *Shell) { shell. NewBranch("original-branch"). EmptyCommit("one"). EmptyCommit("two"). EmptyCommit("three"). CreateFileAndAdd("file", OriginalFileContent). Commit("original"). NewBranch("first-change-branch"). UpdateFileAndAdd("file", FirstChangeFileContent). Commit("first change"). Checkout("original-branch"). NewBranch("second-change-branch"). UpdateFileAndAdd("file", SecondChangeFileContent). Commit("second change"). EmptyCommit("second-change-branch unrelated change"). Checkout("first-change-branch") }
prepares us for a rebase/merge that has conflicts
var OriginalFileContent = `
This
Is
The
Original
File
`
var OriginalFileContentMultiple = `
This
Is
The
Original
File
..
It
Is
Longer
Than
The
Other
Options
`
var SecondChangeFileContent = `
This
Is
The
Second Change
File
`
var SecondChangeFileContentMultiple = `
This
Is
The
Second Change
File
..
It
Is
Longer
Than
The
Other
Other Second Change
`
var SetCustomConflictMarkerSize = func(shell *Shell) { shell.CreateFileAndAdd(".gitattributes", fmt.Sprintf("file conflict-marker-size=%d\n", CustomConflictMarkerSize)). Commit("set a custom conflict marker size") }
Makes git write conflict markers of CustomConflictMarkerSize characters into the file that the setups below create conflicts in. Call this before one of them.
Functions ¶
func HoldIndexLockAfterNextAppliedPatch ¶ added in v0.66.4
func HoldIndexLockAfterNextAppliedPatch(shell *Shell)
HoldIndexLockAfterNextAppliedPatch installs a post-applypatch hook that takes index.lock (see holdIndexLockScript) after "git am" has committed the next patch.
func HoldIndexLockAfterNextCommit ¶ added in v0.66.4
func HoldIndexLockAfterNextCommit(shell *Shell)
HoldIndexLockAfterNextCommit installs a post-commit hook that takes index.lock after the next commit (see holdIndexLockScript).
Install it after creating the commits of the test setup, since it acts on the first commit that is made after it.
func HoldIndexLockBeforeNextPickIsCommitted ¶ added in v0.66.4
func HoldIndexLockBeforeNextPickIsCommitted(shell *Shell)
HoldIndexLockBeforeNextPickIsCommitted installs a reference-transaction hook that takes index.lock (see holdIndexLockScript) the next time a rebase or cherry-pick has applied the changes of a commit, but hasn't committed them yet. This is when git creates CHERRY_PICK_HEAD.
Types ¶
This section is empty.