fsck (receive-pack): allow demoting errors to warnings
For example, missing emails in commit and tag objects can be demoted to
mere warnings with
git config receive.fsck.missingemail=warn
The value is actually a comma-separated list.
In case that the same key is listed in multiple receive.fsck.<msg-id>
lines in the config, the latter configuration wins (this can happen for
example when both $HOME/.gitconfig and .git/config contain message type
settings).
As git receive-pack does not actually perform the checks, it hands off
the setting to index-pack or unpack-objects in the form of an optional
argument to the --strict option.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/fsck.c b/fsck.c
index 41208a4..e6e8dc4 100644
--- a/fsck.c
+++ b/fsck.c
@@ -131,6 +131,14 @@
die("Unknown fsck message type: '%s'", str);
}
+int is_valid_msg_type(const char *msg_id, const char *msg_type)
+{
+ if (parse_msg_id(msg_id) < 0)
+ return 0;
+ parse_msg_type(msg_type);
+ return 1;
+}
+
void fsck_set_msg_type(struct fsck_options *options,
const char *msg_id, const char *msg_type)
{