conflict

package
v15.5.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnmergeableFile     = errors.New("merging is not supported for file")
	ErrUnexpectedDelimiter = errors.New("unexpected conflict delimiter")
	ErrMissingEndDelimiter = errors.New("missing last delimiter")
)

Errors that can occur during parsing of a merge conflict file

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Path     string
	Mode     uint
	Contents []byte
}

Entry is a conflict entry with a path and its original preimage contents.

type File

type File struct {
	// contains filtered or unexported fields
}

File contains an ordered list of lines with metadata about potential conflicts.

func Parse

func Parse(src io.Reader, ancestor, our, their *Entry) (File, error)

Parse will read each line and maintain which conflict section it belongs to

func (File) Resolve

func (f File) Resolve(resolution Resolution) ([]byte, error)

Resolve will iterate through each conflict line and replace it with the specified resolution

type Resolution

type Resolution struct {
	OldPath string `json:"old_path"`
	NewPath string `json:"new_path"`

	// key is a sectionID, value is "head" or "origin"
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL