path: root/fsck.h
diff options
authorJohannes Schindelin <>2015-06-22 15:25:25 (GMT)
committerJunio C Hamano <>2015-06-23 21:26:46 (GMT)
commit0282f4dced029230024196e460b9d9f971f494dd (patch)
tree0634d3385343ed12356328275ad40984058ff080 /fsck.h
parentf417eed8cde2e7def06091977f888c296cbeae00 (diff)
fsck: offer a function to demote fsck errors to warnings
There are legacy repositories out there whose older commits and tags have issues that prevent pushing them when 'receive.fsckObjects' is set. One real-life example is a commit object that has been hand-crafted to list two authors. Often, it is not possible to fix those issues without disrupting the work with said repositories, yet it is still desirable to perform checks by setting `receive.fsckObjects = true`. This commit is the first step to allow demoting specific fsck issues to mere warnings. The `fsck_set_msg_types()` function added by this commit parses a list of settings in the form: missingemail=warn,badname=warn,... Unfortunately, the FSCK_WARN/FSCK_ERROR flag is only really heeded by git fsck so far, but other call paths (e.g. git index-pack --strict) error out *always* no matter what type was specified. Therefore, we need to take extra care to set all message types to FSCK_ERROR by default in those cases. Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'fsck.h')
1 files changed, 7 insertions, 2 deletions
diff --git a/fsck.h b/fsck.h
index f6f268a..af3c84e 100644
--- a/fsck.h
+++ b/fsck.h
@@ -6,6 +6,10 @@
struct fsck_options;
+void fsck_set_msg_type(struct fsck_options *options,
+ const char *msg_id, const char *msg_type);
+void fsck_set_msg_types(struct fsck_options *options, const char *values);
* callback function for fsck_walk
* type is the expected type of the object or OBJ_ANY
@@ -25,10 +29,11 @@ struct fsck_options {
fsck_walk_func walk;
fsck_error error_func;
unsigned strict:1;
+ int *msg_type;
-#define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0 }
-#define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1 }
+#define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0, NULL }
+#define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1, NULL }
/* descend in all linked child objects
* the return value is: