fsck: optionally ignore specific fsck issues completely
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 message type to "ignore". This change "abuses" the missingEmail=warn 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.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jun 22, 2015 at 17:26 UTC
efaba7cc77fb22753675dc1e4f376b61797eca36
3 files changed
+14
-1
fsck.c
+5
@@ -131,6 +131,8 @@ static int parse_msg_type(const char *str)
131
return FSCK_ERROR;
132
else if (!strcmp(str, "warn"))
133
return FSCK_WARN;
134
+ else if (!strcmp(str, "ignore"))
135
+ return FSCK_IGNORE;
136
else
137
die("Unknown fsck message type: '%s'", str);
138
}
@@ -222,6 +224,9 @@ static int report(struct fsck_options *options, struct object *object,
224
struct strbuf sb = STRBUF_INIT;
225
int msg_type = fsck_msg_type(id, options), result;
226
227
+ if (msg_type == FSCK_IGNORE)
228
+ return 0;
229
+
230
if (msg_type == FSCK_FATAL)
231
msg_type = FSCK_ERROR;
232
fsck.h
+1
@@ -3,6 +3,7 @@
3
4
#define FSCK_ERROR 1
5
#define FSCK_WARN 2
6
+#define FSCK_IGNORE 3
7
8
struct fsck_options;
9
t/t5504-fetch-receive-strict.sh
+8
-1
@@ -133,7 +133,14 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
133
git --git-dir=dst/.git config \
134
receive.fsck.missingEmail warn &&
135
git push --porcelain dst bogus >act 2>&1 &&
136
- grep "missingEmail" act
136
+ grep "missingEmail" act &&
137
+ git --git-dir=dst/.git branch -D bogus &&
138
+ git --git-dir=dst/.git config --add \
139
+ receive.fsck.missingEmail ignore &&
140
+ git --git-dir=dst/.git config --add \
141
+ receive.fsck.badDate warn &&
142
+ git push --porcelain dst bogus >act 2>&1 &&
143
+ test_must_fail grep "missingEmail" act
144
'
145
146
test_expect_success \