Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnmergeableFile is returned when the either the file exceeds the // fileLimit or no data was read from the file (in case of a binary file). ErrUnmergeableFile = errors.New("merging is not supported for file") // ErrUnexpectedDelimiter is returned when the previous section doesn't // match the expected flow of sections. ErrUnexpectedDelimiter = errors.New("unexpected conflict delimiter") // ErrMissingEndDelimiter is returned when the final section parsed doesn't // match the expected end state. ErrMissingEndDelimiter = errors.New("missing last delimiter") )
Errors that can occur during parsing of a merge conflict file
Functions ¶
func Resolve ¶ added in v16.2.0
func Resolve(src io.Reader, ours, theirs git.ObjectID, path string, resolution Resolution, appendNewLine bool) (io.Reader, error)
Resolve is used to resolve conflicts for a given blob. It expects the blob to be provided as an io.Reader along with the resolutions for the provided blob. Clients can also use appendNewLine to have an additional new line appended to the end of the resolved buffer.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File contains an ordered list of lines with metadata about potential conflicts.
type Resolution ¶
type Resolution struct { // OldPath is the mapping of the path wrt to 'ours' OID OldPath string `json:"old_path"` // OldPath is the mapping of the path wrt to 'their' OID NewPath string `json:"new_path"` // Sections is a map which is used to denote which section to select // for each conflict. Key is the sectionID, while the value is either // "head" or "origin", which denotes the ours/theirs OIDs respectively. Sections map[string]string `json:"sections"` // Content is used when no sections are defined Content string `json:"content"` }
Resolution indicates how to resolve a conflict
Click to show internal directories.
Click to hide internal directories.