]> git.ipfire.org Git - thirdparty/git.git/blame - fsck.h
Documentation: mention more worktree-specific exceptions
[thirdparty/git.git] / fsck.h
CommitLineData
355885d5
MK
1#ifndef GIT_FSCK_H
2#define GIT_FSCK_H
3
3b41fb0c
RS
4#include "oidset.h"
5
ba002f3b
MK
6#define FSCK_ERROR 1
7#define FSCK_WARN 2
efaba7cc 8#define FSCK_IGNORE 3
ba002f3b 9
22410549 10struct fsck_options;
ef3ca954 11struct object;
22410549 12
0282f4dc
JS
13void fsck_set_msg_type(struct fsck_options *options,
14 const char *msg_id, const char *msg_type);
15void fsck_set_msg_types(struct fsck_options *options, const char *values);
5d477a33 16int is_valid_msg_type(const char *msg_id, const char *msg_type);
0282f4dc 17
355885d5
MK
18/*
19 * callback function for fsck_walk
20 * type is the expected type of the object or OBJ_ANY
21 * the return value is:
22 * 0 everything OK
23 * <0 error signaled and abort
24 * >0 error signaled and do not abort
25 */
22410549 26typedef int (*fsck_walk_func)(struct object *obj, int type, void *data, struct fsck_options *options);
355885d5 27
ba002f3b 28/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
1cd772cc
JS
29typedef int (*fsck_error)(struct fsck_options *o,
30 struct object *obj, int type, const char *message);
ba002f3b 31
1cd772cc
JS
32int fsck_error_function(struct fsck_options *o,
33 struct object *obj, int type, const char *message);
d6ffc8d7 34
22410549
JS
35struct fsck_options {
36 fsck_walk_func walk;
37 fsck_error error_func;
38 unsigned strict:1;
0282f4dc 39 int *msg_type;
3b41fb0c 40 struct oidset skiplist;
7b35efd7 41 struct decoration *object_names;
22410549
JS
42};
43
3b41fb0c
RS
44#define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0, NULL, OIDSET_INIT }
45#define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1, NULL, OIDSET_INIT }
22410549 46
355885d5
MK
47/* descend in all linked child objects
48 * the return value is:
49 * -1 error in processing the object
50 * <0 return value of the callback, which lead to an abort
3ea3c215 51 * >0 return value of the first signaled error >0 (in the case of no other errors)
355885d5
MK
52 * 0 everything OK
53 */
22410549 54int fsck_walk(struct object *obj, void *data, struct fsck_options *options);
90a398bb
JS
55/* If NULL is passed for data, we assume the object is local and read it. */
56int fsck_object(struct object *obj, void *data, unsigned long size,
22410549 57 struct fsck_options *options);
355885d5 58
159e7b08
JK
59/*
60 * Some fsck checks are context-dependent, and may end up queued; run this
61 * after completing all fsck_object() calls in order to resolve any remaining
62 * checks.
63 */
64int fsck_finish(struct fsck_options *options);
65
355885d5 66#endif