MCPcopy Index your code
hub / github.com/go-git/go-git / NewCommitIterBSF

Function NewCommitIterBSF

plumbing/object/commit_walker_bfs.go:23–38  ·  view source on GitHub ↗

NewCommitIterBSF 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 retu

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

Source from the content-addressed store, hash-verified

21// cannot be traversed (e.g. missing objects). Ignore allows to skip some
22// commits from being iterated.
23func NewCommitIterBSF(
24 c *Commit,
25 seenExternal map[plumbing.Hash]bool,
26 ignore []plumbing.Hash,
27) CommitIter {
28 seen := make(map[plumbing.Hash]bool)
29 for _, h := range ignore {
30 seen[h] = true
31 }
32
33 return &bfsCommitIterator{
34 seenExternal: seenExternal,
35 seen: seen,
36 queue: []*Commit{c},
37 }
38}
39
40func (w *bfsCommitIterator) appendHash(store storer.EncodedObjectStorer, h plumbing.Hash) error {
41 if w.seen[h] || w.seenExternal[h] {

Callers 4

commitIterFuncFunction · 0.92
TestCommitBSFIteratorMethod · 0.85
ancestorsIndexFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestCommitBSFIteratorMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…