diff options
author | lhchavez <lhchavez@lhchavez.com> | 2022-04-16 08:19:38 -0700 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2022-04-16 08:23:22 -0700 |
commit | 1d88605ca9d51f9e8695030853d5914743fbb091 (patch) | |
tree | da42e9d207be0f21116c424da6507c337739fc96 /include | |
parent | 63970244fb2d49794e7b5d268a2defe4299fd3ad (diff) | |
download | libgit2-1d88605ca9d51f9e8695030853d5914743fbb091.tar.gz |
transport: introduce `git_transport_smart_remote_connect_options`
6fc6eeb66c40310086c8f059cae41de69ad4c6da removed
`git_transport_smart_proxy_option`, and there was nothing added to
replace it. That made it hard for custom transports / smart
subtransports to know what remote connect options to use (e.g. proxy
options).
This change introduces `git_transport_smart_remote_connect_options` to
replace it.
Diffstat (limited to 'include')
-rw-r--r-- | include/git2/sys/remote.h | 13 | ||||
-rw-r--r-- | include/git2/sys/transport.h | 18 |
2 files changed, 29 insertions, 2 deletions
diff --git a/include/git2/sys/remote.h b/include/git2/sys/remote.h index dd243ca55..bde1b168c 100644 --- a/include/git2/sys/remote.h +++ b/include/git2/sys/remote.h @@ -8,6 +8,8 @@ #ifndef INCLUDE_sys_git_remote_h #define INCLUDE_sys_git_remote_h +#include "git2/remote.h" + /** * @file git2/sys/remote.h * @brief Low-level remote functionality for custom transports @@ -26,6 +28,17 @@ typedef enum { GIT_REMOTE_CAPABILITY_REACHABLE_OID = (1 << 1), } git_remote_capability_t; +/** + * Disposes libgit2-initialized fields from a git_remote_connect_options. + * + * Note that this does not free the `git_remote_connect_options` itself, just + * the memory pointed to by it. + * + * @param opts The `git_remote_connect_options` struct to dispose. + */ +GIT_EXTERN(void) git_remote_connect_options_dispose( + git_remote_connect_options *opts); + /** @} */ GIT_END_DECL #endif diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h index f0c2a3eab..8191f1557 100644 --- a/include/git2/sys/transport.h +++ b/include/git2/sys/transport.h @@ -9,10 +9,11 @@ #define INCLUDE_sys_git_transport_h #include "git2/net.h" +#include "git2/proxy.h" +#include "git2/remote.h" +#include "git2/strarray.h" #include "git2/transport.h" #include "git2/types.h" -#include "git2/strarray.h" -#include "git2/proxy.h" /** * @file git2/sys/transport.h @@ -270,6 +271,19 @@ GIT_EXTERN(int) git_transport_smart_credentials(git_credential **out, git_transp */ GIT_EXTERN(int) git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport); +/** + * Get a copy of the remote connect options + * + * All data is copied and must be freed by the caller by calling + * `git_remote_connect_options_dispose`. + * + * @param out options struct to fill + * @param transport the transport to extract the data from. + */ +GIT_EXTERN(int) git_transport_smart_remote_connect_options( + git_remote_connect_options *out, + git_transport *transport); + /* *** End of base transport interface *** *** Begin interface for subtransports for the smart transport *** |