@@ -44,23 +44,23 @@ typedef enum {
4444 * All ignored files are also stashed and then cleaned up from
4545 * the working directory
4646 */
47- GIT_STASH_INCLUDE_IGNORED = (1 << 2 )
47+ GIT_STASH_INCLUDE_IGNORED = (1 << 2 ),
48+
49+ /**
50+ * All changes in the index and working directory are left intact
51+ */
52+ GIT_STASH_KEEP_ALL = (1 << 3 )
4853} git_stash_flags ;
4954
5055/**
5156 * Save the local modifications to a new stash.
5257 *
5358 * @param out Object id of the commit containing the stashed state.
5459 * This commit is also the target of the direct reference refs/stash.
55- *
5660 * @param repo The owning repository.
57- *
5861 * @param stasher The identity of the person performing the stashing.
59- *
6062 * @param message Optional description along with the stashed state.
61- *
6263 * @param flags Flags to control the stashing process. (see GIT_STASH_* above)
63- *
6464 * @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
6565 * or error code.
6666 */
@@ -71,6 +71,60 @@ GIT_EXTERN(int) git_stash_save(
7171 const char * message ,
7272 uint32_t flags );
7373
74+ /**
75+ * Stash save options structure
76+ *
77+ * Initialize with `GIT_STASH_SAVE_OPTIONS_INIT`. Alternatively, you can
78+ * use `git_stash_save_options_init`.
79+ *
80+ */
81+ typedef struct git_stash_save_options {
82+ unsigned int version ;
83+
84+ /** Flags to control the stashing process. (see GIT_STASH_* above) */
85+ uint32_t flags ;
86+
87+ /** The identity of the person performing the stashing. */
88+ const git_signature * stasher ;
89+
90+ /** Optional description along with the stashed state. */
91+ const char * message ;
92+
93+ /** Optional paths that control which files are stashed. */
94+ git_strarray paths ;
95+ } git_stash_save_options ;
96+
97+ #define GIT_STASH_SAVE_OPTIONS_VERSION 1
98+ #define GIT_STASH_SAVE_OPTIONS_INIT { GIT_STASH_SAVE_OPTIONS_VERSION }
99+
100+ /**
101+ * Initialize git_stash_save_options structure
102+ *
103+ * Initializes a `git_stash_save_options` with default values. Equivalent to
104+ * creating an instance with `GIT_STASH_SAVE_OPTIONS_INIT`.
105+ *
106+ * @param opts The `git_stash_save_options` struct to initialize.
107+ * @param version The struct version; pass `GIT_STASH_SAVE_OPTIONS_VERSION`.
108+ * @return Zero on success; -1 on failure.
109+ */
110+ GIT_EXTERN (int ) git_stash_save_options_init (
111+ git_stash_save_options * opts , unsigned int version );
112+
113+ /**
114+ * Save the local modifications to a new stash, with options.
115+ *
116+ * @param out Object id of the commit containing the stashed state.
117+ * This commit is also the target of the direct reference refs/stash.
118+ * @param repo The owning repository.
119+ * @param opts The stash options.
120+ * @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
121+ * or error code.
122+ */
123+ GIT_EXTERN (int ) git_stash_save_with_opts (
124+ git_oid * out ,
125+ git_repository * repo ,
126+ const git_stash_save_options * opts );
127+
74128/** Stash application flags. */
75129typedef enum {
76130 GIT_STASH_APPLY_DEFAULT = 0 ,
0 commit comments