Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commit ¶
type Commit struct {
Hash string
Author string
Committer string
Date time.Time
Message strings.Builder
Size int // in bytes
// contains filtered or unexported fields
}
Commit contains commit header info and diffs.
type Diff ¶
type Diff struct {
PathB string
LineStart int
IsBinary bool
Commit *Commit
// contains filtered or unexported fields
}
Diff contains the information about a file diff in a commit. It abstracts the underlying content representation, allowing for flexible handling of diff content. The use of contentWriter enables the management of diff data either in memory or on disk, based on its size, optimizing resource usage and performance.
func (*Diff) ReadCloser ¶ added in v3.66.2
func (d *Diff) ReadCloser() (io.ReadCloser, error)
ReadCloser returns a ReadCloser for the contentWriter.
type Option ¶ added in v3.27.0
type Option func(*Parser)
Option is used for adding options to Config.
func UseCustomContentWriter ¶ added in v3.67.2
func UseCustomContentWriter() Option
UseCustomContentWriter sets useCustomContentWriter option.
func UseLowMemoryScan ¶ added in v3.97.5
func UseLowMemoryScan() Option
UseLowMemoryScan sets the scan to optimize for limited memory at the cost of speed (currently up to 9%)
func WithMaxCommitSize ¶ added in v3.27.0
WithMaxCommitSize sets maxCommitSize option. Commits larger than maxCommitSize will be put in the commit channel and additional diffs will be added to a new commit.
func WithMaxDiffSize ¶ added in v3.27.0
WithMaxDiffSize sets maxDiffSize option. Diffs larger than maxDiffSize will be truncated.
func WithWaitDelay ¶ added in v3.93.2
WithWaitDelay sets the waitDelay option. This specifies how long to wait after context cancellation before forcefully killing git processes.
type ParseState ¶ added in v3.45.1
type ParseState int
const ( Initial ParseState = iota CommitLine MergeLine AuthorLine AuthorDateLine CommitterLine CommitterDateLine MessageStartLine MessageLine MessageEndLine NotesStartLine NotesLine NotesEndLine DiffLine ModeLine IndexLine FromFileLine ToFileLine BinaryFileLine HunkLineNumberLine HunkContentLine ParseFailure )
func (ParseState) String ¶ added in v3.45.1
func (state ParseState) String() string
type Parser ¶ added in v3.27.0
type Parser struct {
// contains filtered or unexported fields
}
Parser sets values used in GitParse.
func NewParser ¶ added in v3.27.0
NewParser creates a GitParse config from options and sets defaults.
func (*Parser) FromReader ¶ added in v3.31.3
func (*Parser) RepoPath ¶ added in v3.27.0
func (c *Parser) RepoPath( ctx context.Context, source string, head string, base string, excludedGlobs []string, isBare bool, ) (chan *Diff, error)
RepoPath parses the output of the `git log` command for the `source` path. The Diff chan will return diffs in the order they are parsed from the log, though the diffs are generated using `git show` in groups.
head and base are commit hashes or refs. When base is non-empty the log is restricted to the range base..head (commits reachable from head but not from base), which is the diff-scan contract behind `--since-commit`. The range is computed by git itself so that it is independent of commit dates and merge topology. An empty base means a full-history scan of head (or of --all when head is also empty). An empty head with a non-empty base means every commit reachable from any ref but not from base (`--all ^base`), which is what `--since-commit X` without `--branch` has always covered; callers that want a single-branch diff pass the head explicitly.