99
1010#include "indexer.h"
1111#include "net.h"
12+ #include "types.h"
1213
1314/**
1415 * @file git2/transport.h
@@ -102,8 +103,8 @@ typedef struct git_transport {
102103 git_headlist_cb list_cb ,
103104 void * payload );
104105
105- /* Reserved until push is implemented . */
106- int (* push )(struct git_transport * transport );
106+ /* Executes the push whose context is in the git_push object . */
107+ int (* push )(struct git_transport * transport , git_push * push );
107108
108109 /* This function may be called after a successful call to connect(), when
109110 * the direction is FETCH. The function performs a negotiation to calculate
@@ -123,7 +124,7 @@ typedef struct git_transport {
123124 void * progress_payload );
124125
125126 /* Checks to see if the transport is connected */
126- int (* is_connected )(struct git_transport * transport , int * connected );
127+ int (* is_connected )(struct git_transport * transport );
127128
128129 /* Reads the flags value previously passed into connect() */
129130 int (* read_flags )(struct git_transport * transport , int * flags );
@@ -145,10 +146,11 @@ typedef struct git_transport {
145146 * git:// or http://) and a transport object is returned to the caller.
146147 *
147148 * @param out The newly created transport (out)
149+ * @param owner The git_remote which will own this transport
148150 * @param url The URL to connect to
149151 * @return 0 or an error code
150152 */
151- GIT_EXTERN (int ) git_transport_new (git_transport * * out , const char * url );
153+ GIT_EXTERN (int ) git_transport_new (git_transport * * out , git_remote * owner , const char * url );
152154
153155/**
154156 * Function which checks to see if a transport could be created for the
@@ -161,42 +163,48 @@ GIT_EXTERN(int) git_transport_new(git_transport **out, const char *url);
161163GIT_EXTERN (int ) git_transport_valid_url (const char * url );
162164
163165/* Signature of a function which creates a transport */
164- typedef int (* git_transport_cb )(git_transport * * out , void * payload );
166+ typedef int (* git_transport_cb )(git_transport * * out , git_remote * owner , void * param );
165167
166168/* Transports which come with libgit2 (match git_transport_cb). The expected
167169 * value for "param" is listed in-line below. */
168170
169171/**
170172 * Create an instance of the dummy transport.
171173 *
172- * @param transport The newly created transport (out)
174+ * @param out The newly created transport (out)
175+ * @param owner The git_remote which will own this transport
173176 * @param payload You must pass NULL for this parameter.
174177 * @return 0 or an error code
175178 */
176179GIT_EXTERN (int ) git_transport_dummy (
177- git_transport * * transport ,
180+ git_transport * * out ,
181+ git_remote * owner ,
178182 /* NULL */ void * payload );
179183
180184/**
181185 * Create an instance of the local transport.
182186 *
183- * @param transport The newly created transport (out)
187+ * @param out The newly created transport (out)
188+ * @param owner The git_remote which will own this transport
184189 * @param payload You must pass NULL for this parameter.
185190 * @return 0 or an error code
186191 */
187192GIT_EXTERN (int ) git_transport_local (
188- git_transport * * transport ,
193+ git_transport * * out ,
194+ git_remote * owner ,
189195 /* NULL */ void * payload );
190196
191197/**
192198 * Create an instance of the smart transport.
193199 *
194- * @param transport The newly created transport (out)
200+ * @param out The newly created transport (out)
201+ * @param owner The git_remote which will own this transport
195202 * @param payload A pointer to a git_smart_subtransport_definition
196203 * @return 0 or an error code
197204 */
198205GIT_EXTERN (int ) git_transport_smart (
199- git_transport * * transport ,
206+ git_transport * * out ,
207+ git_remote * owner ,
200208 /* (git_smart_subtransport_definition *) */ void * payload );
201209
202210/*
@@ -221,6 +229,8 @@ GIT_EXTERN(int) git_transport_smart(
221229typedef enum {
222230 GIT_SERVICE_UPLOADPACK_LS = 1 ,
223231 GIT_SERVICE_UPLOADPACK = 2 ,
232+ GIT_SERVICE_RECEIVEPACK_LS = 3 ,
233+ GIT_SERVICE_RECEIVEPACK = 4 ,
224234} git_smart_service_t ;
225235
226236struct git_smart_subtransport ;
@@ -255,6 +265,14 @@ typedef struct git_smart_subtransport {
255265 const char * url ,
256266 git_smart_service_t action );
257267
268+ /* Subtransports are guaranteed a call to close() between
269+ * calls to action(), except for the following two "natural" progressions
270+ * of actions against a constant URL.
271+ *
272+ * 1. UPLOADPACK_LS -> UPLOADPACK
273+ * 2. RECEIVEPACK_LS -> RECEIVEPACK */
274+ int (* close )(struct git_smart_subtransport * transport );
275+
258276 void (* free )(struct git_smart_subtransport * transport );
259277} git_smart_subtransport ;
260278
0 commit comments