diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-12-24 15:14:38 -0600 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-06 15:18:33 -0500 |
commit | 6fc6eeb66c40310086c8f059cae41de69ad4c6da (patch) | |
tree | 0c5453c41d0886abb5eb35faeb2a0d180da91a6d /include/git2/sys/transport.h | |
parent | f99a0d695c0a1a8e44fc1e5216d481ff016ec65d (diff) | |
download | libgit2-ethomson/remote_connect_opts.tar.gz |
remote: introduce `git_remote_connect_options`ethomson/remote_connect_opts
The existing mechanism for providing options to remote fetch/push calls,
and subsequently to transports, is unsatisfactory. It requires an
options structure to avoid breaking the API and callback signatures.
1. Introduce `git_remote_connect_options` to satisfy those needs.
2. Add a new remote connection API, `git_remote_connect_ext` that will
take this new options structure. Existing `git_remote_connect` calls
will proxy to that. `git_remote_fetch` and `git_remote_push` will
proxy their fetch/push options to that as well.
3. Define the interaction between `git_remote_connect` and fetch/push.
Connect _may_ be called before fetch/push, but _need not_ be. The
semantics of which options would be used for these operations was
not specified if you specify options for both connect _and_ fetch.
Now these are defined that the fetch or push options will be used
_if_ they were specified. Otherwise, the connect options will be
used if they were specified. Otherwise, the library's defaults will
be used.
4. Update the transports to understand `git_remote_connect_options`.
This is a breaking change to the systems API.
Diffstat (limited to 'include/git2/sys/transport.h')
-rw-r--r-- | include/git2/sys/transport.h | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h index 76003ee84..89e687649 100644 --- a/include/git2/sys/transport.h +++ b/include/git2/sys/transport.h @@ -24,31 +24,9 @@ GIT_BEGIN_DECL -/** - * Flags to pass to transport - * - * Currently unused. - */ -typedef enum { - GIT_TRANSPORTFLAGS_NONE = 0 -} git_transport_flags_t; - struct git_transport { unsigned int version; /**< The struct version */ - /** Set progress and error callbacks */ - int GIT_CALLBACK(set_callbacks)( - git_transport *transport, - git_transport_message_cb progress_cb, - git_transport_message_cb error_cb, - git_transport_certificate_check_cb certificate_check_cb, - void *payload); - - /** Set custom headers for HTTP requests */ - int GIT_CALLBACK(set_custom_headers)( - git_transport *transport, - const git_strarray *custom_headers); - /** * Connect the transport to the remote repository, using the given * direction. @@ -56,11 +34,17 @@ struct git_transport { int GIT_CALLBACK(connect)( git_transport *transport, const char *url, - git_credential_acquire_cb cred_acquire_cb, - void *cred_acquire_payload, - const git_proxy_options *proxy_opts, int direction, - int flags); + const git_remote_connect_options *connect_opts); + + /** + * Resets the connect options for the given transport. This + * is useful for updating settings or callbacks for an already + * connected transport. + */ + int GIT_CALLBACK(set_connect_opts)( + git_transport *transport, + const git_remote_connect_options *connect_opts); /** * Get the list of available references in the remote repository. @@ -75,7 +59,9 @@ struct git_transport { git_transport *transport); /** Executes the push whose context is in the git_push object. */ - int GIT_CALLBACK(push)(git_transport *transport, git_push *push, const git_remote_callbacks *callbacks); + int GIT_CALLBACK(push)( + git_transport *transport, + git_push *push); /** * Negotiate a fetch with the remote repository. @@ -99,16 +85,11 @@ struct git_transport { int GIT_CALLBACK(download_pack)( git_transport *transport, git_repository *repo, - git_indexer_progress *stats, - git_indexer_progress_cb progress_cb, - void *progress_payload); + git_indexer_progress *stats); /** Checks to see if the transport is connected */ int GIT_CALLBACK(is_connected)(git_transport *transport); - /** Reads the flags value previously passed into connect() */ - int GIT_CALLBACK(read_flags)(git_transport *transport, int *flags); - /** Cancels any outstanding transport operation */ void GIT_CALLBACK(cancel)(git_transport *transport); |