summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-03-28 13:15:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-29 02:03:10 (GMT)
commit1b32b59f9bd78b3475195a6e99c629a5ffefdea0 (patch)
tree40abab6619ea51e264aa8c605757851358865f5a /builtin
parente35d65a78ab7520b2705b27062758ab20a60e462 (diff)
downloadgit-1b32b59f9bd78b3475195a6e99c629a5ffefdea0.zip
git-1b32b59f9bd78b3475195a6e99c629a5ffefdea0.tar.gz
git-1b32b59f9bd78b3475195a6e99c629a5ffefdea0.tar.bz2
fsck.h: move FSCK_{FATAL,INFO,ERROR,WARN,IGNORE} into an enum
Move the FSCK_{FATAL,INFO,ERROR,WARN,IGNORE} defines into a new fsck_msg_type enum. These defines were originally introduced in: - ba002f3b28a (builtin-fsck: move common object checking code to fsck.c, 2008-02-25) - f50c4407305 (fsck: disallow demoting grave fsck errors to warnings, 2015-06-22) - efaba7cc77f (fsck: optionally ignore specific fsck issues completely, 2015-06-22) - f27d05b1704 (fsck: allow upgrading fsck warnings to errors, 2015-06-22) The reason these were defined in two different places is because we use FSCK_{IGNORE,INFO,FATAL} only in fsck.c, but FSCK_{ERROR,WARN} are used by external callbacks. Untangling that would take some more work, since we expose the new "enum fsck_msg_type" to both. Similar to "enum object_type" it's not worth structuring the API in such a way that only those who need FSCK_{ERROR,WARN} pass around a different type. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fsck.c2
-rw-r--r--builtin/index-pack.c3
-rw-r--r--builtin/mktag.c3
3 files changed, 5 insertions, 3 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index ed5f2af..17940a4 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -84,7 +84,7 @@ static int objerror(struct object *obj, const char *err)
static int fsck_error_func(struct fsck_options *o,
const struct object_id *oid,
enum object_type object_type,
- int msg_type, const char *message)
+ enum fsck_msg_type msg_type, const char *message)
{
switch (msg_type) {
case FSCK_WARN:
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 69f24fe..56b8efa 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1716,7 +1716,8 @@ static void show_pack_info(int stat_only)
static int print_dangling_gitmodules(struct fsck_options *o,
const struct object_id *oid,
enum object_type object_type,
- int msg_type, const char *message)
+ enum fsck_msg_type msg_type,
+ const char *message)
{
/*
* NEEDSWORK: Plumb the MSG_ID (from fsck.c) here and use it
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 23c4b87..052a510 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -17,7 +17,8 @@ static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
static int mktag_fsck_error_func(struct fsck_options *o,
const struct object_id *oid,
enum object_type object_type,
- int msg_type, const char *message)
+ enum fsck_msg_type msg_type,
+ const char *message)
{
switch (msg_type) {
case FSCK_WARN: