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, )
| 24 | // cannot be traversed (e.g. missing objects). Ignore allows to skip some |
| 25 | // commits from being iterated. |
| 26 | func 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 | |
| 44 | func (w *commitPreIterator) Next() (*Commit, error) { |
| 45 | var c *Commit |
no outgoing calls
searching dependent graphs…