@@ -61,6 +61,26 @@ GIT_EXTERN(int) git_stash_save(
6161 const char * message ,
6262 unsigned int flags );
6363
64+ /**
65+ * Apply a single stashed state from the stash list.
66+ *
67+ * @param repo The owning repository.
68+ *
69+ * @param index The position within the stash list. 0 points to the
70+ * most recent stashed state.
71+ *
72+ * @param reinstate_index Try to reinstate not only the working tree's changes,
73+ * but also the index's ones.
74+ *
75+ * @return 0 on success, GIT_ENOTFOUND if there's no stashed state for the given
76+ * index, GIT_EMERGECONFLICT on merge conflict in the workdir, GIT_EUNMERGED on
77+ * merge conflict in the index (if reinstating the index), or error code.
78+ */
79+ GIT_EXTERN (int ) git_stash_apply (
80+ git_repository * repo ,
81+ size_t index ,
82+ int reinstate_index );
83+
6484/**
6585 * This is a callback function you can provide to iterate over all the
6686 * stashed states that will be invoked per entry.
@@ -70,7 +90,7 @@ GIT_EXTERN(int) git_stash_save(
7090 * @param message The stash message.
7191 * @param stash_id The commit oid of the stashed state.
7292 * @param payload Extra parameter to callback function.
73- * @return 0 to continue iterating or non-zero to stop
93+ * @return 0 to continue iterating or non-zero to stop.
7494 */
7595typedef int (* git_stash_cb )(
7696 size_t index ,
@@ -90,7 +110,7 @@ typedef int (*git_stash_cb)(
90110 *
91111 * @param payload Extra parameter to callback function.
92112 *
93- * @return 0 on success, non-zero callback return value, or error code
113+ * @return 0 on success, non-zero callback return value, or error code.
94114 */
95115GIT_EXTERN (int ) git_stash_foreach (
96116 git_repository * repo ,
@@ -105,13 +125,34 @@ GIT_EXTERN(int) git_stash_foreach(
105125 * @param index The position within the stash list. 0 points to the
106126 * most recent stashed state.
107127 *
108- * @return 0 on success, or error code
128+ * @return 0 on success, GIT_ENOTFOUND if there's no stashed state for the given
129+ * index, or error code.
109130 */
110-
111131GIT_EXTERN (int ) git_stash_drop (
112132 git_repository * repo ,
113133 size_t index );
114134
135+ /**
136+ * Apply a single stashed state from the stash list and remove it from the list
137+ * if successful.
138+ *
139+ * @param repo The owning repository.
140+ *
141+ * @param index The position within the stash list. 0 points to the
142+ * most recent stashed state.
143+ *
144+ * @param reinstate_index Try to reinstate not only the working tree's changes,
145+ * but also the index's ones.
146+ *
147+ * @return 0 on success, GIT_ENOTFOUND if there's no stashed state for the given
148+ * index, GIT_EMERGECONFLICT on merge conflict in the workdir, GIT_EUNMERGED on
149+ * merge conflict in the index (if reinstating the index), or error code.
150+ */
151+ GIT_EXTERN (int ) git_stash_pop (
152+ git_repository * repo ,
153+ size_t index ,
154+ int reinstate_index );
155+
115156/** @} */
116157GIT_END_DECL
117158#endif
0 commit comments