@@ -16,13 +16,18 @@ check_verify_failure () {
16
16
message=$2 &&
17
17
shift 2 &&
18
18
19
+ no_strict= &&
20
+ fsck_obj_ok= &&
19
21
no_strict= &&
20
22
while test $# ! = 0
21
23
do
22
24
case " $1 " in
23
25
--no-strict)
24
26
no_strict=yes
25
27
;;
28
+ --fsck-obj-ok)
29
+ fsck_obj_ok=yes
30
+ ;;
26
31
esac &&
27
32
shift
28
33
done &&
@@ -37,6 +42,23 @@ check_verify_failure () {
37
42
git mktag --no-strict <tag.sig
38
43
fi
39
44
'
45
+
46
+ test_expect_success " setup: $subject " '
47
+ # Reset any leftover state from the last $subject
48
+ rm -rf bad-tag &&
49
+
50
+ git init --bare bad-tag &&
51
+ git -C bad-tag hash-object -t tag -w --stdin --literally <tag.sig
52
+ '
53
+
54
+ test_expect_success " hash-object & fsck unreachable: $subject " '
55
+ if test -n "$fsck_obj_ok"
56
+ then
57
+ git -C bad-tag fsck
58
+ else
59
+ test_must_fail git -C bad-tag fsck
60
+ fi
61
+ '
40
62
}
41
63
42
64
test_expect_mktag_success () {
@@ -183,7 +205,8 @@ tagger . <> 0 +0000
183
205
EOF
184
206
185
207
check_verify_failure ' verify object (hash/type) check -- correct type, nonexisting object' \
186
- ' ^fatal: could not read tagged object'
208
+ ' ^fatal: could not read tagged object' \
209
+ --fsck-obj-ok
187
210
188
211
cat > tag.sig << EOF
189
212
object $head
@@ -216,7 +239,8 @@ tagger . <> 0 +0000
216
239
EOF
217
240
218
241
check_verify_failure ' verify object (hash/type) check -- mismatched type, valid object' \
219
- ' ^fatal: object.*tagged as.*tree.*but is.*commit'
242
+ ' ^fatal: object.*tagged as.*tree.*but is.*commit' \
243
+ --fsck-obj-ok
220
244
221
245
# ###########################################################
222
246
# 9.5. verify object (hash/type) check -- replacement
@@ -245,7 +269,8 @@ tagger . <> 0 +0000
245
269
EOF
246
270
247
271
check_verify_failure ' verify object (hash/type) check -- mismatched type, valid object' \
248
- ' ^fatal: object.*tagged as.*tree.*but is.*blob'
272
+ ' ^fatal: object.*tagged as.*tree.*but is.*blob' \
273
+ --fsck-obj-ok
249
274
250
275
# ###########################################################
251
276
# 10. verify tag-name check
260
285
261
286
check_verify_failure ' verify tag-name check' \
262
287
' ^error:.* badTagName:' \
263
- --no-strict
288
+ --no-strict \
289
+ --fsck-obj-ok
264
290
265
291
# ###########################################################
266
292
# 11. tagger line label check #1
275
301
276
302
check_verify_failure ' "tagger" line label check #1' \
277
303
' ^error:.* missingTaggerEntry:' \
278
- --no-strict
304
+ --no-strict \
305
+ --fsck-obj-ok
279
306
280
307
# ###########################################################
281
308
# 12. tagger line label check #2
291
318
292
319
check_verify_failure ' "tagger" line label check #2' \
293
320
' ^error:.* missingTaggerEntry:' \
294
- --no-strict
321
+ --no-strict \
322
+ --fsck-obj-ok
295
323
296
324
# ###########################################################
297
325
# 13. allow missing tag author name like fsck
321
349
322
350
check_verify_failure ' disallow malformed tagger' \
323
351
' ^error:.* badEmail:' \
324
- --no-strict
352
+ --no-strict \
353
+ --fsck-obj-ok
325
354
326
355
# ###########################################################
327
356
# 15. allow empty tag email
446
475
447
476
check_verify_failure ' detect invalid header entry' \
448
477
' ^error:.* extraHeaderEntry:' \
449
- --no-strict
478
+ --no-strict \
479
+ --fsck-obj-ok
450
480
451
481
test_expect_success ' invalid header entry config & fsck' '
452
482
test_must_fail git mktag <tag.sig &&
0 commit comments