Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff struct { FromID string ToID string OldMode int32 NewMode int32 FromPath []byte ToPath []byte Binary bool Status byte Patch []byte OverflowMarker bool Collapsed bool TooLarge bool // contains filtered or unexported fields }
Diff represents a single parsed diff entry
type Limits ¶ added in v0.20.0
type Limits struct { // If true, Max{Files,Lines,Bytes} will cause parsing to stop if any of these limits is reached EnforceLimits bool // If true, SafeMax{Files,Lines,Bytes} will cause diffs to collapse (i.e. patches are emptied) after any of these limits reached CollapseDiffs bool // Number of maximum files to parse. The file parsed after this limit is reached is marked as the overflow. MaxFiles int // Number of diffs lines to parse (including lines preceded with --- or +++). // The file in which this limit is reached is discarded and marked as the overflow. MaxLines int // Number of bytes to parse (including lines preceded with --- or +++). // The file in which this limit is reached is discarded and marked as the overflow. MaxBytes int // Number of files to parse, after which all subsequent files are collapsed. SafeMaxFiles int // Number of lines to parse (including lines preceded with --- or +++), after which all subsequent files are collapsed. SafeMaxLines int // Number of bytes to parse (including lines preceded with --- or +++), after which all subsequent files are collapsed. SafeMaxBytes int // Number of bytes a single patch can have. Patches surpassing this limit are pruned / nullified. MaxPatchBytes int }
Limits holds the limits at which either parsing stops or patches are collapsed
type NumStatParser ¶ added in v0.115.0
type NumStatParser struct {
// contains filtered or unexported fields
}
NumStatParser holds necessary state for parsing the numstat output
func NewDiffNumStatParser ¶ added in v0.115.0
func NewDiffNumStatParser(src io.Reader) *NumStatParser
NewDiffNumStatParser returns a new NumStatParser
func (*NumStatParser) NextNumStat ¶ added in v0.115.0
func (parser *NumStatParser) NextNumStat() (*NumStat, error)
NextNumStat reads from git diff --numstat -z command, parses the stats and returns a *NumStat.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser holds necessary state for parsing a diff stream
func NewDiffParser ¶
NewDiffParser returns a new Parser
func (*Parser) Diff ¶
Diff returns a successfully parsed diff. It should be called only when Parser.Parse() returns true.
Click to show internal directories.
Click to hide internal directories.