@@ -44,23 +44,23 @@ typedef enum {
44
44
* All ignored files are also stashed and then cleaned up from
45
45
* the working directory
46
46
*/
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 )
48
53
} git_stash_flags ;
49
54
50
55
/**
51
56
* Save the local modifications to a new stash.
52
57
*
53
58
* @param out Object id of the commit containing the stashed state.
54
59
* This commit is also the target of the direct reference refs/stash.
55
- *
56
60
* @param repo The owning repository.
57
- *
58
61
* @param stasher The identity of the person performing the stashing.
59
- *
60
62
* @param message Optional description along with the stashed state.
61
- *
62
63
* @param flags Flags to control the stashing process. (see GIT_STASH_* above)
63
- *
64
64
* @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
65
65
* or error code.
66
66
*/
@@ -71,6 +71,60 @@ GIT_EXTERN(int) git_stash_save(
71
71
const char * message ,
72
72
uint32_t flags );
73
73
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
+
74
128
/** Stash application flags. */
75
129
typedef enum {
76
130
GIT_STASH_APPLY_DEFAULT = 0 ,
0 commit comments