summaryrefslogtreecommitdiff
path: root/include/git2/stash.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-10-04 15:13:43 +0200
committernulltoken <emeric.fermas@gmail.com>2012-10-26 22:11:09 +0200
commit233884131d123432d2e1ad7236ad3c6ef7b2b518 (patch)
tree7badf8a263468f8cba00a1568b4fc06cf25b17c1 /include/git2/stash.h
parent590fb68be087ed8a60323026dc2501c456ede945 (diff)
downloadlibgit2-233884131d123432d2e1ad7236ad3c6ef7b2b518.tar.gz
stash: add git_stash_foreach()
Diffstat (limited to 'include/git2/stash.h')
-rw-r--r--include/git2/stash.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/git2/stash.h b/include/git2/stash.h
index cadc65673..6ebf89ed1 100644
--- a/include/git2/stash.h
+++ b/include/git2/stash.h
@@ -62,6 +62,46 @@ GIT_EXTERN(int) git_stash_save(
const char *message,
uint32_t flags);
+/**
+ * When iterating over all the stashed states, callback that will be
+ * issued per entry.
+ *
+ * @param index The position within the stash list. 0 points to the
+ * most recent stashed state.
+ *
+ * @param message The stash message.
+ *
+ * @param stash_oid The commit oid of the stashed state.
+ *
+ * @param payload Extra parameter to callback function.
+ *
+ * @return 0 on success, GIT_EUSER on non-zero callback, or error code
+ */
+typedef int (*stash_cb)(
+ size_t index,
+ const char* message,
+ const git_oid *stash_oid,
+ void *payload);
+
+/**
+ * Loop over all the stashed states and issue a callback for each one.
+ *
+ * If the callback returns a non-zero value, this will stop looping.
+ *
+ * @param repo Repository where to find the stash.
+ *
+ * @param callabck Callback to invoke per found stashed state. The most recent
+ * stash state will be enumerated first.
+ *
+ * @param payload Extra parameter to callback function.
+ *
+ * @return 0 on success, GIT_EUSER on non-zero callback, or error code
+ */
+GIT_EXTERN(int) git_stash_foreach(
+ git_repository *repo,
+ stash_cb callback,
+ void *payload);
+
/** @} */
GIT_END_DECL
#endif