Fifth batch for 2.19 cycle
[git/git.git] / connected.h
CommitLineData
f96400cb
JH
1#ifndef CONNECTED_H
2#define CONNECTED_H
3
c6807a40
NTND
4struct transport;
5
f96400cb
JH
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 */
6ccac9ee 11typedef int (*oid_iterate_fn)(void *, struct object_id *oid);
f96400cb 12
7043c707
JK
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;
e0331849
JK
26
27 /*
28 * If non-zero, send error messages to this descriptor rather
29 * than stderr. The descriptor is closed before check_connected
30 * returns.
31 */
32 int err_fd;
70d5e2d7
JK
33
34 /* If non-zero, show progress as we traverse the objects. */
35 int progress;
526f108a
JK
36
37 /*
38 * Insert these variables into the environment of the child process.
39 */
40 const char **env;
cf1e7c07
JT
41
42 /*
43 * If non-zero, check the ancestry chain completely, not stopping at
44 * any existing ref. This is necessary when deepening existing refs
45 * during a fetch.
46 */
47 unsigned is_deepening_fetch : 1;
7043c707
JK
48};
49
50#define CHECK_CONNECTED_INIT { 0 }
51
f96400cb
JH
52/*
53 * Make sure that our object store has all the commits necessary to
54 * connect the ancestry chain to some of our existing refs, and all
55 * the trees and blobs that these commits use.
56 *
57 * Return 0 if Ok, non zero otherwise (i.e. some missing objects)
7043c707
JK
58 *
59 * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed.
f96400cb 60 */
6ccac9ee 61int check_connected(oid_iterate_fn fn, void *cb_data,
7043c707 62 struct check_connected_options *opt);
f96400cb
JH
63
64#endif /* CONNECTED_H */