(
callbacks=None, reinstate_index=False, strategy=None, directory=None, paths=None
)
| 852 | |
| 853 | @contextmanager |
| 854 | def 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 |
no test coverage detected
searching dependent graphs…