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)
| 266 | // |
| 267 | // If callback returns an error, this will stop looping. |
| 268 | func (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 | // |
nothing calls this directly
no test coverage detected