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

Method ForEach

plumbing/object/commitgraph/commitnode.go:80–99  ·  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(CommitNode) error)

Source from the content-addressed store, hash-verified

78// an error appends or the end of the iter is reached. If ErrStop is sent
79// the iteration is stopped but no error is returned. The iterator is closed.
80func (iter *parentCommitNodeIter) ForEach(cb func(CommitNode) error) error {
81 for {
82 obj, err := iter.Next()
83 if err != nil {
84 if err == io.EOF {
85 return nil
86 }
87
88 return err
89 }
90
91 if err := cb(obj); err != nil {
92 if err == storer.ErrStop {
93 return nil
94 }
95
96 return err
97 }
98 }
99}
100
101func (iter *parentCommitNodeIter) Close() {
102}

Callers

nothing calls this directly

Calls 1

NextMethod · 0.95

Tested by

no test coverage detected