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

Method ForEach

packbuilder.go:163–185  ·  view source on GitHub ↗

ForEach repeatedly calls the callback with new packfile data until there is no more data or the callback returns an error

(callback PackbuilderForeachCallback)

Source from the content-addressed store, hash-verified

161// ForEach repeatedly calls the callback with new packfile data until
162// there is no more data or the callback returns an error
163func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error {
164 var err error
165 data := packbuilderCallbackData{
166 callback: callback,
167 errorTarget: &err,
168 }
169 handle := pointerHandles.Track(&data)
170 defer pointerHandles.Untrack(handle)
171
172 runtime.LockOSThread()
173 defer runtime.UnlockOSThread()
174
175 ret := C._go_git_packbuilder_foreach(pb.ptr, handle)
176 runtime.KeepAlive(pb)
177 if ret == C.int(ErrorCodeUser) && err != nil {
178 return err
179 }
180 if ret < 0 {
181 return MakeGitError(ret)
182 }
183
184 return nil
185}

Callers 1

WriteMethod · 0.95

Calls 3

MakeGitErrorFunction · 0.85
TrackMethod · 0.80
UntrackMethod · 0.80

Tested by

no test coverage detected