12594efa1637f81bfd21070e9bb952bad4b5e662
   1#ifndef CONNECTED_H
   2#define CONNECTED_H
   3
   4struct transport;
   5
   6/*
   7 * Take callback data, and return next object name in the buffer.
   8 * When called after returning the name for the last object, return -1
   9 * to signal EOF, otherwise return 0.
  10 */
  11typedef int (*sha1_iterate_fn)(void *, unsigned char [20]);
  12
  13/*
  14 * Named-arguments struct for check_connected. All arguments are
  15 * optional, and can be left to defaults as set by CHECK_CONNECTED_INIT.
  16 */
  17struct check_connected_options {
  18        /* Avoid printing any errors to stderr. */
  19        int quiet;
  20
  21        /* --shallow-file to pass to rev-list sub-process */
  22        const char *shallow_file;
  23
  24        /* Transport whose objects we are checking, if available. */
  25        struct transport *transport;
  26};
  27
  28#define CHECK_CONNECTED_INIT { 0 }
  29
  30/*
  31 * Make sure that our object store has all the commits necessary to
  32 * connect the ancestry chain to some of our existing refs, and all
  33 * the trees and blobs that these commits use.
  34 *
  35 * Return 0 if Ok, non zero otherwise (i.e. some missing objects)
  36 *
  37 * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed.
  38 */
  39int check_connected(sha1_iterate_fn fn, void *cb_data,
  40                    struct check_connected_options *opt);
  41
  42#endif /* CONNECTED_H */