summaryrefslogtreecommitdiff
path: root/include/git2/remote.h
diff options
context:
space:
mode:
authorErik Aigner <aigner.erik@gmail.com>2019-04-08 15:54:25 +0200
committerEtienne Samson <samson.etienne@gmail.com>2019-05-21 14:11:08 +0200
commit59647e1ad095f80112918971b7bbe05adfaf8c3c (patch)
tree5e2ce79da3ad292505f58a6962047d2baba9f887 /include/git2/remote.h
parent4aa36ff2c0fe2e7b29220737c757ffff99e00059 (diff)
downloadlibgit2-59647e1ad095f80112918971b7bbe05adfaf8c3c.tar.gz
remote: add callback to resolve URLs before connecting
Since libssh2 doesn't read host configuration from the config file, this callback can be used to hand over URL resolving to the client without touching the SSH implementation itself.
Diffstat (limited to 'include/git2/remote.h')
-rw-r--r--include/git2/remote.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 5a82558d2..f757f67ea 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -475,6 +475,20 @@ typedef int GIT_CALLBACK(git_push_negotiation)(const git_push_update **updates,
typedef int GIT_CALLBACK(git_push_update_reference_cb)(const char *refname, const char *status, void *data);
/**
+ * Callback to resolve URLs before connecting to remote
+ *
+ * If you return GIT_PASSTHROUGH, you don't need to write anything to
+ * url_resolved.
+ *
+ * @param url_resolved The buffer to write the resolved URL to
+ * @param url The URL to resolve
+ * @param direction GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
+ * @param payload Payload provided by the caller
+ * @return 0 on success, GIT_PASSTHROUGH or an error
+ */
+typedef int GIT_CALLBACK(git_url_resolve_cb)(git_buf *url_resolved, const char *url, int direction, void *payload);
+
+/**
* The callback settings structure
*
* Set the callbacks to be called by the remote when informing the user
@@ -562,6 +576,12 @@ struct git_remote_callbacks {
* as the last parameter.
*/
void *payload;
+
+ /**
+ * Resolve URL before connecting to remote.
+ * The returned URL will be used to connect to the remote instead.
+ */
+ git_url_resolve_cb resolve_url;
};
#define GIT_REMOTE_CALLBACKS_VERSION 1