🌐 AI搜索 & 代理 主页
blob: afa48cc0524764a65053f5bb1392142de3251609 [file] [log] [blame]
Junio C Hamanof96400c2011-09-02 23:33:221#ifndef CONNECTED_H
2#define CONNECTED_H
3
Nguyễn Thái Ngọc Duyc6807a42013-05-26 01:16:174struct transport;
5
Junio C Hamanof96400c2011-09-02 23:33:226/*
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/*
Jeff King7043c702016-07-15 10:30:4014 * 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;
Jeff Kinge0331842016-07-15 10:32:0326
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;
Jeff King70d5e2d2016-07-15 10:32:2833
34 /* If non-zero, show progress as we traverse the objects. */
35 int progress;
Jeff King7043c702016-07-15 10:30:4036};
37
38#define CHECK_CONNECTED_INIT { 0 }
39
40/*
Junio C Hamanof96400c2011-09-02 23:33:2241 * Make sure that our object store has all the commits necessary to
42 * connect the ancestry chain to some of our existing refs, and all
43 * the trees and blobs that these commits use.
44 *
45 * Return 0 if Ok, non zero otherwise (i.e. some missing objects)
Jeff King7043c702016-07-15 10:30:4046 *
47 * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed.
Junio C Hamanof96400c2011-09-02 23:33:2248 */
Jeff King7043c702016-07-15 10:30:4049int check_connected(sha1_iterate_fn fn, void *cb_data,
50 struct check_connected_options *opt);
Junio C Hamanof96400c2011-09-02 23:33:2251
52#endif /* CONNECTED_H */