Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 1 | #ifndef CONNECTED_H |
| 2 | #define CONNECTED_H |
| 3 | |
Nguyễn Thái Ngọc Duy | c6807a4 | 2013-05-26 08:16:17 +0700 | [diff] [blame] | 4 | struct transport; |
| 5 | |
Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 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 | */ |
brian m. carlson | 6ccac9e | 2017-10-15 22:06:54 +0000 | [diff] [blame] | 11 | typedef int (*oid_iterate_fn)(void *, struct object_id *oid); |
Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 12 | |
| 13 | /* |
Jeff King | 7043c70 | 2016-07-15 06:30:40 -0400 | [diff] [blame] | 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 | */ |
| 17 | struct 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 King | e033184 | 2016-07-15 06:32:03 -0400 | [diff] [blame] | 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; |
Jeff King | 70d5e2d | 2016-07-15 06:32:28 -0400 | [diff] [blame] | 33 | |
| 34 | /* If non-zero, show progress as we traverse the objects. */ |
| 35 | int progress; |
Jeff King | 526f108 | 2016-10-03 16:49:08 -0400 | [diff] [blame] | 36 | |
| 37 | /* |
| 38 | * Insert these variables into the environment of the child process. |
| 39 | */ |
| 40 | const char **env; |
Jeff King | 7043c70 | 2016-07-15 06:30:40 -0400 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | #define CHECK_CONNECTED_INIT { 0 } |
| 44 | |
| 45 | /* |
Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 46 | * Make sure that our object store has all the commits necessary to |
| 47 | * connect the ancestry chain to some of our existing refs, and all |
| 48 | * the trees and blobs that these commits use. |
| 49 | * |
| 50 | * Return 0 if Ok, non zero otherwise (i.e. some missing objects) |
Jeff King | 7043c70 | 2016-07-15 06:30:40 -0400 | [diff] [blame] | 51 | * |
| 52 | * If "opt" is NULL, behaves as if CHECK_CONNECTED_INIT was passed. |
Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 53 | */ |
brian m. carlson | 6ccac9e | 2017-10-15 22:06:54 +0000 | [diff] [blame] | 54 | int check_connected(oid_iterate_fn fn, void *cb_data, |
Jeff King | 7043c70 | 2016-07-15 06:30:40 -0400 | [diff] [blame] | 55 | struct check_connected_options *opt); |
Junio C Hamano | f96400c | 2011-09-02 16:33:22 -0700 | [diff] [blame] | 56 | |
| 57 | #endif /* CONNECTED_H */ |