THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.6KB

  1. #ifndef TRANSPORT_INTERNAL_H
  2. #define TRANSPORT_INTERNAL_H
  3. struct ref;
  4. struct transport;
  5. struct argv_array;
  6. struct transport_vtable {
  7. /**
  8. * Returns 0 if successful, positive if the option is not
  9. * recognized or is inapplicable, and negative if the option
  10. * is applicable but the value is invalid.
  11. **/
  12. int (*set_option)(struct transport *connection, const char *name,
  13. const char *value);
  14. /**
  15. * Returns a list of the remote side's refs. In order to allow
  16. * the transport to try to share connections, for_push is a
  17. * hint as to whether the ultimate operation is a push or a fetch.
  18. *
  19. * If communicating using protocol v2 a list of prefixes can be
  20. * provided to be sent to the server to enable it to limit the ref
  21. * advertisement. Since ref filtering is done on the server's end, and
  22. * only when using protocol v2, this list will be ignored when not
  23. * using protocol v2 meaning this function can return refs which don't
  24. * match the provided ref_prefixes.
  25. *
  26. * If the transport is able to determine the remote hash for
  27. * the ref without a huge amount of effort, it should store it
  28. * in the ref's old_sha1 field; otherwise it should be all 0.
  29. **/
  30. struct ref *(*get_refs_list)(struct transport *transport, int for_push,
  31. const struct argv_array *ref_prefixes);
  32. /**
  33. * Fetch the objects for the given refs. Note that this gets
  34. * an array, and should ignore the list structure.
  35. *
  36. * If the transport did not get hashes for refs in
  37. * get_refs_list(), it should set the old_sha1 fields in the
  38. * provided refs now.
  39. **/
  40. int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
  41. /**
  42. * Push the objects and refs. Send the necessary objects, and
  43. * then, for any refs where peer_ref is set and
  44. * peer_ref->new_oid is different from old_oid, tell the
  45. * remote side to update each ref in the list from old_oid to
  46. * peer_ref->new_oid.
  47. *
  48. * Where possible, set the status for each ref appropriately.
  49. *
  50. * The transport must modify new_sha1 in the ref to the new
  51. * value if the remote accepted the change. Note that this
  52. * could be a different value from peer_ref->new_oid if the
  53. * process involved generating new commits.
  54. **/
  55. int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
  56. int (*connect)(struct transport *connection, const char *name,
  57. const char *executable, int fd[2]);
  58. /** get_refs_list(), fetch(), and push_refs() can keep
  59. * resources (such as a connection) reserved for further
  60. * use. disconnect() releases these resources.
  61. **/
  62. int (*disconnect)(struct transport *connection);
  63. };
  64. #endif