cache.h: add repository argument to oid_object_info
[git/raj.git] / fsck.h
blob4525510d99abfc0ae523e0d556345db84fc8c302
1 #ifndef GIT_FSCK_H
2 #define GIT_FSCK_H
4 #define FSCK_ERROR 1
5 #define FSCK_WARN 2
6 #define FSCK_IGNORE 3
8 struct fsck_options;
10 void fsck_set_msg_type(struct fsck_options *options,
11 const char *msg_id, const char *msg_type);
12 void fsck_set_msg_types(struct fsck_options *options, const char *values);
13 int is_valid_msg_type(const char *msg_id, const char *msg_type);
16 * callback function for fsck_walk
17 * type is the expected type of the object or OBJ_ANY
18 * the return value is:
19 * 0 everything OK
20 * <0 error signaled and abort
21 * >0 error signaled and do not abort
23 typedef int (*fsck_walk_func)(struct object *obj, int type, void *data, struct fsck_options *options);
25 /* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
26 typedef int (*fsck_error)(struct fsck_options *o,
27 struct object *obj, int type, const char *message);
29 int fsck_error_function(struct fsck_options *o,
30 struct object *obj, int type, const char *message);
32 struct fsck_options {
33 fsck_walk_func walk;
34 fsck_error error_func;
35 unsigned strict:1;
36 int *msg_type;
37 struct oid_array *skiplist;
38 struct decoration *object_names;
41 #define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0, NULL }
42 #define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1, NULL }
44 /* descend in all linked child objects
45 * the return value is:
46 * -1 error in processing the object
47 * <0 return value of the callback, which lead to an abort
48 * >0 return value of the first signaled error >0 (in the case of no other errors)
49 * 0 everything OK
51 int fsck_walk(struct object *obj, void *data, struct fsck_options *options);
52 /* If NULL is passed for data, we assume the object is local and read it. */
53 int fsck_object(struct object *obj, void *data, unsigned long size,
54 struct fsck_options *options);
56 #endif