MCPcopy
hub / github.com/go-git/go-git / NewCommitPreorderIter

Function NewCommitPreorderIter

plumbing/object/commit_walker.go:26–42  ·  view source on GitHub ↗

NewCommitPreorderIter returns a CommitIter that walks the commit history, starting at the given commit and visiting its parents in pre-order. The given callback will be called for each visited commit. Each commit will be visited only once. If the callback returns an error, walking will stop and will

(
	c *Commit,
	seenExternal map[plumbing.Hash]bool,
	ignore []plumbing.Hash,
)

Source from the content-addressed store, hash-verified

24// cannot be traversed (e.g. missing objects). Ignore allows to skip some
25// commits from being iterated.
26func NewCommitPreorderIter(
27 c *Commit,
28 seenExternal map[plumbing.Hash]bool,
29 ignore []plumbing.Hash,
30) CommitIter {
31 seen := make(map[plumbing.Hash]bool)
32 for _, h := range ignore {
33 seen[h] = true
34 }
35
36 return &commitPreIterator{
37 seenExternal: seenExternal,
38 seen: seen,
39 stack: make([]CommitIter, 0),
40 start: c,
41 }
42}
43
44func (w *commitPreIterator) Next() (*Commit, error) {
45 var c *Commit

Callers 10

commitIterFuncFunction · 0.92
ResolveRevisionMethod · 0.92
getHavesFromRefFunction · 0.92
isFastForwardFunction · 0.92
reachableObjectsFunction · 0.92
TestCommitPreIteratorMethod · 0.85
IsAncestorMethod · 0.85

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…