Documentation
¶
Overview ¶
Package diff provides a parser for git diff output. It parses the output of: git diff --raw --full-index --find-renames Based on gitaly's implementation (MIT License).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limits ¶
type Limits struct {
// EnforceLimits causes parsing to stop if Max{Files,Lines,Bytes} is reached.
EnforceLimits bool
// CollapseDiffs causes patches to be emptied after SafeMax{Files,Lines,Bytes} reached.
CollapseDiffs bool
// CollectAllPaths parses all diffs but info outside of path may be empty.
CollectAllPaths bool
// MaxFiles is the maximum number of files to parse.
MaxFiles int
// MaxLines is the maximum number of diff lines to parse.
MaxLines int
// MaxBytes is the maximum number of bytes to parse.
MaxBytes int
// SafeMaxFiles is the number of files after which subsequent files are collapsed.
SafeMaxFiles int
// SafeMaxLines is the number of lines after which subsequent files are collapsed.
SafeMaxLines int
// SafeMaxBytes is the number of bytes after which subsequent files are collapsed.
SafeMaxBytes int
// MaxPatchBytes is the maximum bytes a single patch can have.
MaxPatchBytes int
// MaxPatchBytesForFileExtension overrides MaxPatchBytes for specific file types.
MaxPatchBytesForFileExtension map[string]int
// PatchLimitsOnly uses only MaxPatchBytes limits, ignoring cumulative limits.
PatchLimitsOnly bool
}
Limits holds the limits at which either parsing stops or patches are collapsed.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser holds necessary state for parsing a diff stream.
type Patch ¶
type Patch struct {
*diferenco.Patch
Status byte // 'A', 'D', 'M', 'R', 'C', 'T' etc.
Binary bool
OverflowMarker bool
Collapsed bool
TooLarge bool
CollectAllPaths bool
PatchSize int32
LinesAdded int32
LinesRemoved int32
// contains filtered or unexported fields
}
Patch represents a single parsed diff entry, extending diferenco.Patch with git metadata.
Click to show internal directories.
Click to hide internal directories.