@@ -45,6 +45,11 @@ typedef enum {
45
45
* the working directory
46
46
*/
47
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 ),
48
53
} git_stash_flags ;
49
54
50
55
/**
@@ -71,6 +76,67 @@ GIT_EXTERN(int) git_stash_save(
71
76
const char * message ,
72
77
uint32_t flags );
73
78
79
+ /**
80
+ * Stash save options structure
81
+ *
82
+ * Initialize with `GIT_STASH_SAVE_OPTIONS_INIT`. Alternatively, you can
83
+ * use `git_stash_save_options_init`.
84
+ *
85
+ */
86
+ typedef struct git_stash_save_options {
87
+ unsigned int version ;
88
+
89
+ /** The identity of the person performing the stashing. */
90
+ const git_signature * stasher ;
91
+
92
+ /** Optional description along with the stashed state. */
93
+ const char * message ;
94
+
95
+ /** Flags to control the stashing process. (see GIT_STASH_* above) */
96
+ uint32_t flags ;
97
+
98
+ /** Optional paths that control which files are stashed. */
99
+ git_strarray paths ;
100
+ } git_stash_save_options ;
101
+
102
+ #define GIT_STASH_SAVE_OPTIONS_VERSION 1
103
+ #define GIT_STASH_SAVE_OPTIONS_INIT { \
104
+ GIT_STASH_SAVE_OPTIONS_VERSION, \
105
+ NULL, \
106
+ NULL, \
107
+ GIT_STASH_DEFAULT }
108
+
109
+ /**
110
+ * Initialize git_stash_save_options structure
111
+ *
112
+ * Initializes a `git_stash_save_options` with default values. Equivalent to
113
+ * creating an instance with `GIT_STASH_SAVE_OPTIONS_INIT`.
114
+ *
115
+ * @param opts The `git_stash_save_options` struct to initialize.
116
+ * @param version The struct version; pass `GIT_STASH_SAVE_OPTIONS_VERSION`.
117
+ * @return Zero on success; -1 on failure.
118
+ */
119
+ GIT_EXTERN (int ) git_stash_save_options_init (
120
+ git_stash_save_options * opts , unsigned int version );
121
+
122
+ /**
123
+ * Save the local modifications to a new stash, with options.
124
+ *
125
+ * @param out Object id of the commit containing the stashed state.
126
+ * This commit is also the target of the direct reference refs/stash.
127
+ *
128
+ * @param repo The owning repository.
129
+ *
130
+ * @param opts The stash options.
131
+ *
132
+ * @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
133
+ * or error code.
134
+ */
135
+ GIT_EXTERN (int ) git_stash_save_with_opts (
136
+ git_oid * out ,
137
+ git_repository * repo ,
138
+ const git_stash_save_options * opts );
139
+
74
140
/** Stash application flags. */
75
141
typedef enum {
76
142
GIT_STASH_APPLY_DEFAULT = 0 ,
0 commit comments