connected.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef CONNECTED_H
  2. #define CONNECTED_H
  3. struct object_id;
  4. struct transport;
  5. /*
  6. * Take callback data, and return next object name in the buffer.
  7. * When called after returning the name for the last object, return -1
  8. * to signal EOF, otherwise return 0.
  9. */
  10. typedef int (*oid_iterate_fn)(void *, struct object_id *oid);
  11. /*
  12. * Named-arguments struct for check_connected. All arguments are
  13. * optional, and can be left to defaults as set by CHECK_CONNECTED_INIT.
  14. */
  15. struct check_connected_options {
  16. /* Avoid printing any errors to stderr. */
  17. int quiet;
  18. /* --shallow-file to pass to rev-list sub-process */
  19. const char *shallow_file;
  20. /* Transport whose objects we are checking, if available. */
  21. struct transport *transport;
  22. /*
  23. * If non-zero, send error messages to this descriptor rather
  24. * than stderr. The descriptor is closed before check_connected
  25. * returns.
  26. */
  27. int err_fd;
  28. /* If non-zero, show progress as we traverse the objects. */
  29. int progress;
  30. /*
  31. * Insert these variables into the environment of the child process.
  32. */
  33. const char **env;
  34. /*
  35. * If non-zero, check the ancestry chain completely, not stopping at
  36. * any existing ref. This is necessary when deepening existing refs
  37. * during a fetch.
  38. */
  39. unsigned is_deepening_fetch : 1;
  40. };
  41. #define CHECK_CONNECTED_INIT { 0 }
  42. /*
  43. * Make sure that all given objects and all objects reachable from them
  44. * either exist in our object store or (if the repository is a partial
  45. * clone) are promised to be available.
  46. *
  47. * Return 0 if Ok, non zero otherwise (i.e. some missing objects)
  48. *
  49. * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed.
  50. */
  51. int check_connected(oid_iterate_fn fn, void *cb_data,
  52. struct check_connected_options *opt);
  53. #endif /* CONNECTED_H */