MCPcopy Create free account
hub / github.com/libgit2/pygit2 / git_stash_apply_options

Function git_stash_apply_options

pygit2/callbacks.py:854–886  ·  view source on GitHub ↗
(
    callbacks=None, reinstate_index=False, strategy=None, directory=None, paths=None
)

Source from the content-addressed store, hash-verified

852
853@contextmanager
854def git_stash_apply_options(
855 callbacks=None, reinstate_index=False, strategy=None, directory=None, paths=None
856):
857 if callbacks is None:
858 callbacks = StashApplyCallbacks()
859
860 # Set up stash options
861 stash_apply_options = ffi.new('git_stash_apply_options *')
862 check_error(C.git_stash_apply_options_init(stash_apply_options, 1))
863
864 flags = reinstate_index * C.GIT_STASH_APPLY_REINSTATE_INDEX
865 stash_apply_options.flags = flags
866
867 # Now set up checkout options
868 c_checkout_options_ptr = ffi.addressof(stash_apply_options.checkout_options)
869 payload = _git_checkout_options(
870 callbacks=callbacks,
871 strategy=strategy,
872 directory=directory,
873 paths=paths,
874 c_checkout_options_ptr=c_checkout_options_ptr,
875 )
876 assert payload == callbacks
877 assert payload.checkout_options == c_checkout_options_ptr
878
879 # Set up stash progress callback if the user has provided their own
880 if type(callbacks).stash_apply_progress != StashApplyCallbacks.stash_apply_progress:
881 stash_apply_options.progress_cb = C._stash_apply_progress_cb
882 stash_apply_options.progress_payload = payload._ffi_handle
883
884 # Give back control
885 payload.stash_apply_options = stash_apply_options
886 yield payload

Callers 2

stash_applyMethod · 0.70
stash_popMethod · 0.70

Calls 3

StashApplyCallbacksClass · 0.85
check_errorFunction · 0.85
_git_checkout_optionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…