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

Method ForEach

plumbing/object/commit.go:494–503  ·  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

492// an error appends or the end of the iter is reached. If ErrStop is sent
493// the iteration is stopped but no error is returned. The iterator is closed.
494func (iter *storerCommitIter) ForEach(cb func(*Commit) error) error {
495 return iter.EncodedObjectIter.ForEach(func(obj plumbing.EncodedObject) error {
496 c, err := DecodeCommit(iter.s, obj)
497 if err != nil {
498 return err
499 }
500
501 return cb(c)
502 })
503}
504
505func (iter *storerCommitIter) Close() {
506 iter.EncodedObjectIter.Close()

Callers

nothing calls this directly

Calls 2

DecodeCommitFunction · 0.85
ForEachMethod · 0.65

Tested by

no test coverage detected