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

Method Foreach

stash.go:268–289  ·  view source on GitHub ↗

Foreach loops over all the stashed states and calls the callback for each one. If callback returns an error, this will stop looping.

(callback StashCallback)

Source from the content-addressed store, hash-verified

266//
267// If callback returns an error, this will stop looping.
268func (c *StashCollection) Foreach(callback StashCallback) error {
269 var err error
270 data := stashCallbackData{
271 callback: callback,
272 errorTarget: &err,
273 }
274 handle := pointerHandles.Track(&data)
275 defer pointerHandles.Untrack(handle)
276
277 runtime.LockOSThread()
278 defer runtime.UnlockOSThread()
279
280 ret := C._go_git_stash_foreach(c.repo.ptr, handle)
281 runtime.KeepAlive(c)
282 if ret == C.int(ErrorCodeUser) && err != nil {
283 return err
284 }
285 if ret < 0 {
286 return MakeGitError(ret)
287 }
288 return nil
289}
290
291// Drop removes a single stashed state from the stash list.
292//

Callers

nothing calls this directly

Calls 3

MakeGitErrorFunction · 0.85
TrackMethod · 0.80
UntrackMethod · 0.80

Tested by

no test coverage detected