An fsck issue in a legacy repository might be so common that one would
like not to bother the user with mentioning it at all. With this change,
that is possible by setting the respective error to "ignore".

This change "abuses" the warn=missing-email test to verify that "ignore"
is also accepted and works correctly. And while at it, it makes sure
that multiple options work, too (they are passed to unpack-objects or
index-pack as a comma-separated list via the --strict=... command-line
option).

Signed-off-by: Johannes Schindelin <johannes.schinde...@gmx.de>
---
 fsck.c                          | 5 +++++
 fsck.h                          | 1 +
 t/t5504-fetch-receive-strict.sh | 7 ++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/fsck.c b/fsck.c
index f2c8044..649c8fe 100644
--- a/fsck.c
+++ b/fsck.c
@@ -152,6 +152,8 @@ void fsck_set_severity(struct fsck_options *options, const 
char *mode)
                                severity = FSCK_ERROR;
                        else if (!substrcmp(mode, equal, "warn"))
                                severity = FSCK_WARN;
+                       else if (!substrcmp(mode, equal, "ignore"))
+                               severity = FSCK_IGNORE;
                        else
                                die("Unknown fsck message severity: '%.*s'",
                                        equal, mode);
@@ -193,6 +195,9 @@ static int report(struct fsck_options *options, struct 
object *object,
        struct strbuf sb = STRBUF_INIT;
        int msg_severity = fsck_msg_severity(id, options), result;
 
+       if (msg_severity == FSCK_IGNORE)
+               return 0;
+
        if (msg_severity == FSCK_FATAL)
                msg_severity = FSCK_ERROR;
 
diff --git a/fsck.h b/fsck.h
index 4349860..7be6c50 100644
--- a/fsck.h
+++ b/fsck.h
@@ -3,6 +3,7 @@
 
 #define FSCK_ERROR 1
 #define FSCK_WARN 2
+#define FSCK_IGNORE 3
 
 struct fsck_options;
 
diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index 2757c3a..e81cedb 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -132,7 +132,12 @@ test_expect_success 'push with receive.fsck.warn = 
missing-email' '
        test_must_fail git push --porcelain dst bogus &&
        git --git-dir=dst/.git config receive.fsck.warn missing-email &&
        git push --porcelain dst bogus >act 2>&1 &&
-       grep "missing-email" act
+       grep "missing-email" act &&
+       git --git-dir=dst/.git branch -D bogus &&
+       git  --git-dir=dst/.git config receive.fsck.ignore missing-email &&
+       git  --git-dir=dst/.git config receive.fsck.warn bad-date &&
+       git push --porcelain dst bogus >act 2>&1 &&
+       test_must_fail grep "missing-email" act
 '
 
 test_expect_success 'receive.fsck.warn = unterminated-header triggers error' '
-- 
2.0.0.rc3.9669.g840d1f9



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to