MCPcopy Create free account
hub / github.com/go-git/go-git / ForEach

Method ForEach

plumbing/object/commit.go:585–594  ·  view source on GitHub ↗

ForEach call the cb function for each commit contained on this iter until an error appends or the end of the iter is reached. If ErrStop is sent the iteration is stopped but no error is returned. The iterator is closed.

(cb func(*Commit) error)

Source from the content-addressed store, hash-verified

583// an error appends or the end of the iter is reached. If ErrStop is sent
584// the iteration is stopped but no error is returned. The iterator is closed.
585func (iter *storerCommitIter) ForEach(cb func(*Commit) error) error {
586 return iter.EncodedObjectIter.ForEach(func(obj plumbing.EncodedObject) error {
587 c, err := DecodeCommit(iter.s, obj)
588 if err != nil {
589 return err
590 }
591
592 return cb(c)
593 })
594}
595
596func (iter *storerCommitIter) Close() {
597 iter.EncodedObjectIter.Close()

Callers

nothing calls this directly

Calls 2

DecodeCommitFunction · 0.85
ForEachMethod · 0.65

Tested by

no test coverage detected