1 #ifndef TRANSPORT_INTERNAL_H
2 #define TRANSPORT_INTERNAL_H
8 struct transport_vtable {
10 * Returns 0 if successful, positive if the option is not
11 * recognized or is inapplicable, and negative if the option
12 * is applicable but the value is invalid.
14 int (*set_option)(struct transport *connection, const char *name,
17 * Returns a list of the remote side's refs. In order to allow
18 * the transport to try to share connections, for_push is a
19 * hint as to whether the ultimate operation is a push or a fetch.
21 * If the transport is able to determine the remote hash for
22 * the ref without a huge amount of effort, it should store it
23 * in the ref's old_sha1 field; otherwise it should be all 0.
25 struct ref *(*get_refs_list)(struct transport *transport, int for_push,
26 const struct argv_array *ref_patterns);
29 * Fetch the objects for the given refs. Note that this gets
30 * an array, and should ignore the list structure.
32 * If the transport did not get hashes for refs in
33 * get_refs_list(), it should set the old_sha1 fields in the
36 int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
39 * Push the objects and refs. Send the necessary objects, and
40 * then, for any refs where peer_ref is set and
41 * peer_ref->new_oid is different from old_oid, tell the
42 * remote side to update each ref in the list from old_oid to
45 * Where possible, set the status for each ref appropriately.
47 * The transport must modify new_sha1 in the ref to the new
48 * value if the remote accepted the change. Note that this
49 * could be a different value from peer_ref->new_oid if the
50 * process involved generating new commits.
52 int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
53 int (*connect)(struct transport *connection, const char *name,
54 const char *executable, int fd[2]);
56 /** get_refs_list(), fetch(), and push_refs() can keep
57 * resources (such as a connection) reserved for further
58 * use. disconnect() releases these resources.
60 int (*disconnect)(struct transport *connection);