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.

60 lines
1.6KB

  1. #ifndef FETCH_NEGOTIATOR_H
  2. #define FETCH_NEGOTIATOR_H
  3. struct commit;
  4. struct repository;
  5. /*
  6. * An object that supplies the information needed to negotiate the contents of
  7. * the to-be-sent packfile during a fetch.
  8. *
  9. * To set up the negotiator, call fetch_negotiator_init(), then known_common()
  10. * (0 or more times), then add_tip() (0 or more times).
  11. *
  12. * Then, when "have" lines are required, call next(). Call ack() to report what
  13. * the server tells us.
  14. *
  15. * Once negotiation is done, call release(). The negotiator then cannot be used
  16. * (unless reinitialized with fetch_negotiator_init()).
  17. */
  18. struct fetch_negotiator {
  19. /*
  20. * Before negotiation starts, indicate that the server is known to have
  21. * this commit.
  22. */
  23. void (*known_common)(struct fetch_negotiator *, struct commit *);
  24. /*
  25. * Once this function is invoked, known_common() cannot be invoked any
  26. * more.
  27. *
  28. * Indicate that this commit and all its ancestors are to be checked
  29. * for commonality with the server.
  30. */
  31. void (*add_tip)(struct fetch_negotiator *, struct commit *);
  32. /*
  33. * Once this function is invoked, known_common() and add_tip() cannot
  34. * be invoked any more.
  35. *
  36. * Return the next commit that the client should send as a "have" line.
  37. */
  38. const struct object_id *(*next)(struct fetch_negotiator *);
  39. /*
  40. * Inform the negotiator that the server has the given commit. This
  41. * method must only be called on commits returned by next().
  42. */
  43. int (*ack)(struct fetch_negotiator *, struct commit *);
  44. void (*release)(struct fetch_negotiator *);
  45. /* internal use */
  46. void *data;
  47. };
  48. void fetch_negotiator_init(struct repository *r,
  49. struct fetch_negotiator *negotiator);
  50. #endif