remote: add typedef to normalize push_update_reference callback Very many callbacks in libgit2 have some sort of typedef to normalize the name at git_<name_of_operation>_cb. Add a typedef for push_update_references in the remote so the name follows the same conventions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/include/git2/remote.h b/include/git2/remote.h
index b1e04d5..22e2291 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -386,6 +386,20 @@ typedef struct {
typedef int (*git_push_negotiation)(const git_push_update **updates, size_t len, void *payload);
/**
+ * Callback used to inform of the update status from the remote.
+ *
+ * Called for each updated reference on push. If `status` is
+ * not `NULL`, the update was rejected by the remote server
+ * and `status` contains the reason given.
+ *
+ * @param refname refname specifying to the remote ref
+ * @param status status message sent from the remote
+ * @param data data provided by the caller
+ * @return 0 on success, otherwise an error
+ */
+typedef int (*git_push_update_reference_cb)(const char *refname, const char *status, void *data);
+
+/**
* The callback settings structure
*
* Set the callbacks to be called by the remote when informing the user
@@ -452,11 +466,9 @@ struct git_remote_callbacks {
git_push_transfer_progress push_transfer_progress;
/**
- * Called for each updated reference on push. If `status` is
- * not `NULL`, the update was rejected by the remote server
- * and `status` contains the reason given.
+ * See documentation of git_push_update_reference_cb
*/
- int (*push_update_reference)(const char *refname, const char *status, void *data);
+ git_push_update_reference_cb push_update_reference;
/**
* Called once between the negotiation step and the upload. It