Pop applies a single stashed state from the stash list and removes it from the list if successful. 'index' is the position within the stash list. 0 points to the most recent stashed state. 'opts' controls how stashes are applied. Returns error code ErrorCodeNotFound if there's no stashed state fo
(index int, opts StashApplyOptions)
| 318 | // Returns error code ErrorCodeNotFound if there's no stashed |
| 319 | // state for the given index. |
| 320 | func (c *StashCollection) Pop(index int, opts StashApplyOptions) error { |
| 321 | var err error |
| 322 | optsC := populateStashApplyOptions(&C.git_stash_apply_options{}, &opts, &err) |
| 323 | defer freeStashApplyOptions(optsC) |
| 324 | |
| 325 | runtime.LockOSThread() |
| 326 | defer runtime.UnlockOSThread() |
| 327 | |
| 328 | ret := C.git_stash_pop(c.repo.ptr, C.size_t(index), optsC) |
| 329 | runtime.KeepAlive(c) |
| 330 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 331 | return err |
| 332 | } |
| 333 | if ret < 0 { |
| 334 | return MakeGitError(ret) |
| 335 | } |
| 336 | return nil |
| 337 | } |