MCPcopy Create free account
hub / github.com/libgit2/git2go / ForEach

Method ForEach

branch.go:68–83  ·  view source on GitHub ↗
(f BranchIteratorFunc)

Source from the content-addressed store, hash-verified

66}
67
68func (i *BranchIterator) ForEach(f BranchIteratorFunc) error {
69 b, t, err := i.Next()
70
71 for err == nil {
72 err = f(b, t)
73 if err == nil {
74 b, t, err = i.Next()
75 }
76 }
77
78 if err != nil && IsErrorCode(err, ErrorCodeIterOver) {
79 return nil
80 }
81
82 return err
83}
84
85func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, error) {
86 refType := C.git_branch_t(flags)

Callers 1

TestBranchIteratorEachFunction · 0.95

Calls 2

NextMethod · 0.95
IsErrorCodeFunction · 0.85

Tested by 1

TestBranchIteratorEachFunction · 0.76