git_diff_parser

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 7 Imported by: 4 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ContentChangeTypeAdd    = contentChangeTypeAdd
	ContentChangeTypeDelete = contentChangeTypeDelete
	ContentChangeTypeModify = contentChangeTypeModify
	ContentChangeTypeNOOP   = contentChangeTypeNOOP

	FileDiffTypeAdded    = fileDiffTypeAdded
	FileDiffTypeDeleted  = fileDiffTypeDeleted
	FileDiffTypeModified = fileDiffTypeModified
)

Variables

View Source
var ErrPatchConflict = errors.New("patch conflict")

Functions

func ApplyFile added in v0.1.0

func ApplyFile(pristine, patchData []byte) ([]byte, error)

func ApplyFileWithConflicts added in v0.1.0

func ApplyFileWithConflicts(pristine, patchData []byte) ([]byte, error)

func ApplyPatchOperations added in v0.2.0

func ApplyPatchOperations(tree map[string][]byte, operations []PatchOperation) (map[string][]byte, error)

ApplyPatchOperations applies ordered patch operations to a copy of tree.

func ApplyPatchset added in v0.1.0

func ApplyPatchset(tree map[string][]byte, patchData []byte) (map[string][]byte, error)

func SignificantChange

func SignificantChange(diff string, isSignificant func(*FileDiff, *ContentChange) (bool, string)) (significant bool, msg string, err error)

Types

type ContentChange

type ContentChange = contentChange

type ContentChangeType

type ContentChangeType = contentChangeType

type FileDiff

type FileDiff = fileDiff

type FileDiffType

type FileDiffType = fileDiffType

type PatchOperation added in v0.2.0

type PatchOperation struct {
	Type       PatchOperationType
	SourcePath string
	TargetPath string
	OldMode    string
	NewMode    string
	IndexMode  string
	IsBinary   bool
	Patch      []byte
	// contains filtered or unexported fields
}

PatchOperation describes one file-level operation in a git patchset.

Values returned by ParsePatchOperations can be passed to ApplyPatchOperations.

func ParsePatchOperations added in v0.2.0

func ParsePatchOperations(patchData []byte) ([]PatchOperation, error)

ParsePatchOperations parses patchData into ordered file-level operations.

func (*PatchOperation) MutatesFileSet added in v0.2.0

func (op *PatchOperation) MutatesFileSet() bool

MutatesFileSet reports whether this operation adds, removes, or moves a file.

type PatchOperationType added in v0.2.0

type PatchOperationType string
const (
	PatchOperationTypeModify     PatchOperationType = "modify"
	PatchOperationTypeCreate     PatchOperationType = "create"
	PatchOperationTypeDelete     PatchOperationType = "delete"
	PatchOperationTypeRename     PatchOperationType = "rename"
	PatchOperationTypeCopy       PatchOperationType = "copy"
	PatchOperationTypeModeChange PatchOperationType = "mode_change"
	PatchOperationTypeBinary     PatchOperationType = "binary"
)

Jump to

Keyboard shortcuts

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