Merge branch 'js/rebase-config-bitfix'
[git/raj.git] / connected.h
blobce2e7d8f2e535aac72fb317448ad20fb2133429b
1 #ifndef CONNECTED_H
2 #define CONNECTED_H
4 struct object_id;
5 struct transport;
7 /*
8 * Take callback data, and return next object name in the buffer.
9 * When called after returning the name for the last object, return -1
10 * to signal EOF, otherwise return 0.
12 typedef int (*oid_iterate_fn)(void *, struct object_id *oid);
15 * Named-arguments struct for check_connected. All arguments are
16 * optional, and can be left to defaults as set by CHECK_CONNECTED_INIT.
18 struct check_connected_options {
19 /* Avoid printing any errors to stderr. */
20 int quiet;
22 /* --shallow-file to pass to rev-list sub-process */
23 const char *shallow_file;
25 /* Transport whose objects we are checking, if available. */
26 struct transport *transport;
29 * If non-zero, send error messages to this descriptor rather
30 * than stderr. The descriptor is closed before check_connected
31 * returns.
33 int err_fd;
35 /* If non-zero, show progress as we traverse the objects. */
36 int progress;
39 * Insert these variables into the environment of the child process.
41 const char **env;
44 * If non-zero, check the ancestry chain completely, not stopping at
45 * any existing ref. This is necessary when deepening existing refs
46 * during a fetch.
48 unsigned is_deepening_fetch : 1;
51 * If non-zero, only check the top-level objects referenced by the
52 * wanted refs (passed in as cb_data). This is useful for partial
53 * clones, where enumerating and excluding all promisor objects is very
54 * slow and the commit-walk itself becomes a no-op.
56 unsigned check_refs_only : 1;
59 #define CHECK_CONNECTED_INIT { 0 }
62 * Make sure that all given objects and all objects reachable from them
63 * either exist in our object store or (if the repository is a partial
64 * clone) are promised to be available.
66 * Return 0 if Ok, non zero otherwise (i.e. some missing objects)
68 * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed.
70 int check_connected(oid_iterate_fn fn, void *cb_data,
71 struct check_connected_options *opt);
73 #endif /* CONNECTED_H */