summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-05-01 18:34:38 -0400
committerEdward Thomson <ethomson@microsoft.com>2015-05-11 14:12:42 -0400
commit4ea3eebf4b53274b885f749f543101f6633c665e (patch)
tree527861b4c15a3780418dc9ffa11b828a2af7f2da /include/git2
parent19c80a6fd1cfc0300e3a99f72fb8056431ba521e (diff)
downloadlibgit2-4ea3eebf4b53274b885f749f543101f6633c665e.tar.gz
stash_apply: provide progress callbacks
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/stash.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/git2/stash.h b/include/git2/stash.h
index 1f773dcb0..526db0ba2 100644
--- a/include/git2/stash.h
+++ b/include/git2/stash.h
@@ -80,6 +80,40 @@ typedef enum {
GIT_STASH_APPLY_REINSTATE_INDEX = (1 << 0),
} git_stash_apply_flags;
+typedef enum {
+ GIT_STASH_APPLY_PROGRESS_NONE = 0,
+
+ /** Loading the stashed data from the object database. */
+ GIT_STASH_APPLY_PROGRESS_LOADING_STASH,
+
+ /** The stored index is being analyzed. */
+ GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX,
+
+ /** The modified files are being analyzed. */
+ GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED,
+
+ /** The untracked and ignored files are being analyzed. */
+ GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED,
+
+ /** The untracked files are being written to disk. */
+ GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED,
+
+ /** The modified files are being written to disk. */
+ GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED,
+
+ /** The stash was applied successfully. */
+ GIT_STASH_APPLY_PROGRESS_DONE,
+} git_stash_apply_progress_t;
+
+/**
+ * Stash application progress notification function.
+ * Return 0 to continue processing, or a negative value to
+ * abort the stash application.
+ */
+typedef int (*git_stash_apply_progress_cb)(
+ git_stash_apply_progress_t progress,
+ void *payload);
+
/** Stash application options structure.
*
* Initialize with the `GIT_STASH_APPLY_OPTIONS_INIT` macro to set
@@ -95,6 +129,10 @@ typedef struct git_stash_apply_options {
/** Options to use when writing files to the working directory. */
git_checkout_options checkout_options;
+
+ /** Optional callback to notify the consumer of application progress. */
+ git_stash_apply_progress_cb progress_cb;
+ void *progress_payload;
} git_stash_apply_options;
#define GIT_STASH_APPLY_OPTIONS_VERSION 1