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

Method Pop

stash.go:320–337  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

318// Returns error code ErrorCodeNotFound if there's no stashed
319// state for the given index.
320func (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}

Callers 1

TestStashFunction · 0.80

Calls 3

freeStashApplyOptionsFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by 1

TestStashFunction · 0.64