diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-04-22 15:45:21 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-13 09:46:36 +0200 |
| commit | 058b753ceb8f6b25b77e57106b3a87997bc6362a (patch) | |
| tree | 2ad699eda443d924a51d18aaa61c22e10f7eba31 /include/git2 | |
| parent | 6fb373a0e8eeff3c94853ff0ac55ca6b561c44a1 (diff) | |
| download | libgit2-058b753ceb8f6b25b77e57106b3a87997bc6362a.tar.gz | |
remote: move the transport ctor to the callbacks
Instead of having it set in a different place from every other callback,
put it the main structure. This removes some state from the remote and
makes it behave more like clone, where the constructors are passed via
the options.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/remote.h | 6 | ||||
| -rw-r--r-- | include/git2/sys/transport.h | 20 | ||||
| -rw-r--r-- | include/git2/transport.h | 3 | ||||
| -rw-r--r-- | include/git2/types.h | 6 |
4 files changed, 15 insertions, 20 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h index 41cf8512f..22aad5ad4 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -484,6 +484,12 @@ struct git_remote_callbacks { git_push_negotiation push_negotiation; /** + * Create the transport to use for this operation. Leave NULL + * to auto-detect. + */ + git_transport_cb transport; + + /** * This will be passed to each of the callbacks in this struct * as the last parameter. */ diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h index d6ca8ff05..867fbcbce 100644 --- a/include/git2/sys/transport.h +++ b/include/git2/sys/transport.h @@ -30,8 +30,6 @@ typedef enum { GIT_TRANSPORTFLAGS_NONE = 0, } git_transport_flags_t; -typedef struct git_transport git_transport; - struct git_transport { unsigned int version; /* Set progress and error callbacks */ @@ -142,9 +140,6 @@ GIT_EXTERN(int) git_transport_new(git_transport **out, git_remote *owner, const */ GIT_EXTERN(int) git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *payload); -/* Signature of a function which creates a transport */ -typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param); - /** * Add a custom transport definition, to be used in addition to the built-in * set of transports that come with libgit2. @@ -353,21 +348,6 @@ GIT_EXTERN(int) git_smart_subtransport_ssh( git_transport* owner, void *param); -/** - * Sets a custom transport factory for the remote. The caller can use this - * function to override the transport used for this remote when performing - * network operations. - * - * @param remote the remote to configure - * @param transport_cb the function to use to create a transport - * @param payload opaque parameter passed to transport_cb - * @return 0 or an error code - */ -GIT_EXTERN(int) git_remote_set_transport( - git_remote *remote, - git_transport_cb transport_cb, - void *payload); - /** @} */ GIT_END_DECL #endif diff --git a/include/git2/transport.h b/include/git2/transport.h index c10907f5f..99fd09a1b 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -20,6 +20,9 @@ */ GIT_BEGIN_DECL +/** Signature of a function which creates a transport */ +typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param); + /** * Type of SSH host fingerprint */ diff --git a/include/git2/types.h b/include/git2/types.h index fdb5f2b09..d1e7cd92c 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -224,6 +224,12 @@ typedef struct git_refspec git_refspec; typedef struct git_remote git_remote; /** + * Interface which represents a transport to communicate with a + * remote. + */ +typedef struct git_transport git_transport; + +/** * Preparation for a push operation. Can be used to configure what to * push and the level of parallelism of the packfile builder. */ |
