diff

package
v0.0.0-...-4681efc Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LineOperationModify = LineOperation('M')
	LineOperationAdd    = LineOperation('A')
	LineOperationDelete = LineOperation('D')
)
View Source
const (
	StatusAdd        = StatusType('A')
	StatusCopy       = StatusType('C')
	StatusDelete     = StatusType('D')
	StatusModify     = StatusType('M')
	StatusRename     = StatusType('R')
	StatusChangeType = StatusType('T')
	StatusUnmerged   = StatusType('U')
	StatusUnknown    = StatusType('X')
)

Variables

View Source
var (
	ErrMalformedDiff       = errors.New("malformed diff")
	ErrUnknownStatusLetter = fmt.Errorf("%w: invalid status letter", ErrMalformedDiff)
)

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Status   Status
	Lines    []*Line
	Src      State
	Dst      State
	IsBinary bool
}

func Calculate

func Calculate(
	ctx context.Context,
	repoPath string,
	commitA, commitB string,
) ([]*Diff, error)

type Line

type Line struct {
	Operation LineOperation
	Src       LineState
	Dst       LineState
}

type LineOperation

type LineOperation rune

type LineState

type LineState struct {
	Number  int64
	Content string
}

type Mode

type Mode uint32

type State

type State struct {
	Mode Mode
	SHA1 []byte
	Path string
}

type Status

type Status struct {
	Type  StatusType
	Score *int
}

type StatusType

type StatusType rune

Jump to

Keyboard shortcuts

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