summaryrefslogtreecommitdiff
path: root/include/git2/remote.h
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-07-27 09:52:44 -0700
committerVicent Martí <vicent@github.com>2012-07-27 09:52:44 -0700
commit60d5cc57473ad6ecf05f50d15bb101e3348897f0 (patch)
tree27773ac98806290b456cf3f29a5dd4ede40c5895 /include/git2/remote.h
parentf0244463ad280664d2cac950fcc5d6ff550905d1 (diff)
parentb3aaa7a7c887006d38b7262b73575d40f51beca5 (diff)
downloadlibgit2-60d5cc57473ad6ecf05f50d15bb101e3348897f0.tar.gz
Merge pull request #834 from carlosmn/network-callbacks
Add a struct for network callbacks
Diffstat (limited to 'include/git2/remote.h')
-rw-r--r--include/git2/remote.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 6d4b6cc20..7e563f96f 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -220,7 +220,7 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote);
* @param remote the remote to update
* @param cb callback to run on each ref update. 'a' is the old value, 'b' is then new value
*/
-GIT_EXTERN(int) git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, const git_oid *a, const git_oid *b));
+GIT_EXTERN(int) git_remote_update_tips(git_remote *remote);
/**
* Return whether a string is a valid remote URL
@@ -268,6 +268,39 @@ GIT_EXTERN(int) git_remote_add(git_remote **out, git_repository *repo, const cha
GIT_EXTERN(void) git_remote_check_cert(git_remote *remote, int check);
+/**
+ * Argument to the completion callback which tells it which operation
+ * finished.
+ */
+typedef enum git_remote_completion_type {
+ GIT_REMOTE_COMPLETION_DOWNLOAD,
+ GIT_REMOTE_COMPLETION_INDEXING,
+ GIT_REMOTE_COMPLETION_ERROR,
+} git_remote_completion_type;
+
+/**
+ * The callback settings structure
+ *
+ * Set the calbacks to be called by the remote.
+ */
+struct git_remote_callbacks {
+ int (*progress)(const char *str, void *data);
+ int (*completion)(git_remote_completion_type type, void *data);
+ int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data);
+ void *data;
+};
+
+/**
+ * Set the callbacks for a remote
+ *
+ * Note that the remote keeps its own copy of the data and you need to
+ * call this function again if you want to change the callbacks.
+ *
+ * @param remote the remote to configure
+ * @param callbacks a pointer to the user's callback settings
+ */
+GIT_EXTERN(void) git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callbacks);
+
/** @} */
GIT_END_DECL
#endif