summaryrefslogtreecommitdiff
path: root/include/git2/remote.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-27 10:59:51 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-08-29 10:39:28 -0400
commit72df17c659619707e4e5f27b2a51db60848a1d04 (patch)
treea89dda4f75833c96669446c94fd7e0ff56f19fff /include/git2/remote.h
parent672406773e677e69dba0ccf1c6a116cb2886b60a (diff)
downloadlibgit2-72df17c659619707e4e5f27b2a51db60848a1d04.tar.gz
remote: introduce git_remote_ready_cb
Introduce a new callback that fires when the remote is ready to connect.
Diffstat (limited to 'include/git2/remote.h')
-rw-r--r--include/git2/remote.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 5b67717eb..b75a9911c 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -514,6 +514,18 @@ typedef int GIT_CALLBACK(git_push_update_reference_cb)(const char *refname, cons
typedef int GIT_CALLBACK(git_url_resolve_cb)(git_buf *url_resolved, const char *url, int direction, void *payload);
/**
+ * Callback invoked immediately before we attempt to connect to the
+ * given url. Callers may change the URL before the connection by
+ * calling `git_remote_set_instance_url` in the callback.
+ *
+ * @param remote The remote to be connected
+ * @param direction GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
+ * @param payload Payload provided by the caller
+ * @return 0 on success, or an error
+ */
+typedef int GIT_CALLBACK(git_remote_ready_cb)(git_remote *remote, int direction, void *payload);
+
+/**
* The callback settings structure
*
* Set the callbacks to be called by the remote when informing the user
@@ -598,6 +610,11 @@ struct git_remote_callbacks {
git_transport_cb transport;
/**
+ * Callback when the remote is ready to connect.
+ */
+ git_remote_ready_cb remote_ready;
+
+ /**
* This will be passed to each of the callbacks in this struct
* as the last parameter.
*/