Documentation ¶
Index ¶
Constants ¶
const ( Local = 1 Incoming = 2 )
Represents user's conflict resolution decision
Variables ¶
var ErrInvalidManualInput = errors.New("Newly edited code is invalid")
ErrInvalidManualInput is thrown when the manual code editing session results in deletion of the conflict markers in the text
Functions ¶
This section is empty.
Types ¶
type Conflict ¶
type Conflict struct { File *File Choice int Start int Middle int End int Diff3 []int LocalLines []string LocalPureLines []string IncomingLines []string ColoredLocalLines []string ColoredIncomingLines []string CurrentName string ForeignName string TopPeek int BottomPeek int }
Conflict represents a single conflict that may have occurred
func ExtractConflicts ¶
ExtractConflicts extracts all conflicts from the provided `File` It returns an error if it fails to parse the conflict markers and if syntax highlighting fatally fails TODO: Prevent crashes from syntax highlighting
func GroupConflictMarkers ¶
GroupConflictMarkers groups the provided lines of a file into individual `Conflict` structs It returns an error if the line contains invalid number of conflicts. This may be caused if the user manually edits the file.
func (*Conflict) Extract ¶ added in v1.1.0
Extract extracts lines where conflicts exist and corresponding branch names
func (*Conflict) HighlightSyntax ¶ added in v1.0.4
HighlightSyntax highlights the stored file lines; both local and incoming lines The highlighted versions of the lines are stored in Conflict.Colored____Lines If the file extension is not supported, no highlights are applied
func (*Conflict) PaddingLines ¶
PaddingLines returns top and bottom padding lines based on `TopPeek` and `BottomPeek` values
type File ¶
File represents a single file that contains git merge conflicts
func Find ¶
Find runs `git --no-pager diff --check` in order to detect git conflicts It returns an array of `File`s where each `File` contains conflicts within itself If the parsing fails, it returns an error
func (File) WriteChanges ¶
WriteChanges writes all the resolved conflicts in a given file to the file system.