summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-01 11:16:37 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-01 15:05:59 -0700
commit093fffdfbec4ce3fee9a5cebde0aae87bcebb0cc (patch)
tree7e63d6c96ec50fe9c7f1fc4fecd4a06d2274d15c /t
parentMerge branch 'ds/sparse-index-protections' (diff)
downloadtgif-093fffdfbec4ce3fee9a5cebde0aae87bcebb0cc.tar.xz
fsck tests: add test for fsck-ing an unknown type
Fix a blindspot in the fsck tests by checking what we do when we encounter an unknown "garbage" type produced with hash-object's --literally option. This behavior needs to be improved, which'll be done in subsequent patches, but for now let's test for the current behavior. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1450-fsck.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 5071ac63a5..beb233e91b 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -865,4 +865,20 @@ test_expect_success 'detect corrupt index file in fsck' '
test_i18ngrep "bad index file" errors
'
+test_expect_success 'fsck hard errors on an invalid object type' '
+ git init --bare garbage-type &&
+ (
+ cd garbage-type &&
+
+ git hash-object --stdin -w -t garbage --literally </dev/null &&
+
+ cat >err.expect <<-\EOF &&
+ fatal: invalid object type
+ EOF
+ test_must_fail git fsck >out 2>err &&
+ test_cmp err.expect err &&
+ test_must_be_empty out
+ )
+'
+
test_done