From: Daniel Barkalow <barkalow@xxxxxxxxxxxx> In particular, explain which of the fields of struct ref is used for what purpose in the input to and output from each function. Signed-off-by: Daniel Barkalow <barkalow@xxxxxxxxxxxx> Signed-off-by: Johan Herland <johan@xxxxxxxxxxx> --- transport.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/transport.h b/transport.h index 3cb0abc..b45e6c5 100644 --- a/transport.h +++ b/transport.h @@ -18,11 +18,49 @@ struct transport { int (*set_option)(struct transport *connection, const char *name, const char *value); + /** + * Returns a list of the remote side's refs. In order to allow + * the transport to try to share connections, for_push is a + * hint as to whether the ultimate operation is a push or a fetch. + * + * If the transport is able to determine the remote hash for + * the ref without a huge amount of effort, it should store it + * in the ref's old_sha1 field; otherwise it should be all 0. + **/ struct ref *(*get_refs_list)(struct transport *transport, int for_push); + + /** + * Fetch the objects for the given refs. Note that this gets + * an array, and should ignore the list structure. + * + * If the transport did not get hashes for refs in + * get_refs_list(), it should set the old_sha1 fields in the + * provided refs now. + **/ int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs); + + /** + * Push the objects and refs. Send the necessary objects, and + * then tell the remote side to update each ref in the list + * from old_sha1 to new_sha1. + * + * Where possible, set the status for each ref appropriately. + * + * If, in the process, the transport determines that the + * remote side actually responded to the push by updating the + * ref to a different value, the transport should modify the + * new_sha1 in the ref. (Note that this is a matter of the + * remote accepting but rewriting the change, not rejecting it + * and reporting that a different update had already taken + * place) + **/ int (*push_refs)(struct transport *transport, struct ref *refs, int flags); int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags); + /** get_refs_list(), fetch(), and push_refs() can keep + * resources (such as a connection) reserved for futher + * use. disconnect() releases these resources. + **/ int (*disconnect)(struct transport *connection); char *pack_lockfile; signed verbose : 2; -- 1.6.4.rc3.138.ga6b98.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html