From 53692df2b82f9d5ce15779da7d5227f1b027e193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 28 Mar 2021 15:15:47 +0200 Subject: fsck.c: add an fsck_set_msg_type() API that takes enums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change code I added in acf9de4c94e (mktag: use fsck instead of custom verify_tag(), 2021-01-05) to make use of a new API function that takes the fsck_msg_{id,type} types, instead of arbitrary strings that we'll (hopefully) parse into those types. At the time that the fsck_set_msg_type() API was introduced in 0282f4dced0 (fsck: offer a function to demote fsck errors to warnings, 2015-06-22) it was only intended to be used to parse user-supplied data. For things that are purely internal to the C code it makes sense to have the compiler check these arguments, and to skip the sanity checking of the data in fsck_set_msg_type() which is redundant to checks we get from the compiler. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- builtin/mktag.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin/mktag.c') diff --git a/builtin/mktag.c b/builtin/mktag.c index 96e63bc772..dddcccdd36 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -88,7 +88,8 @@ int cmd_mktag(int argc, const char **argv, const char *prefix) die_errno(_("could not read from stdin")); fsck_options.error_func = mktag_fsck_error_func; - fsck_set_msg_type(&fsck_options, "extraheaderentry", "warn"); + fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY, + FSCK_WARN); /* config might set fsck.extraHeaderEntry=* again */ git_config(git_fsck_config, &fsck_options); if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options, -- cgit v1.2.3