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>

Ævar Arnfjörð Bjarmason committed Oct 1, 2021 at 11:16 UTC 093fffdfbec4ce3fee9a5cebde0aae87bcebb0cc
1 file changed +16
t/t1450-fsck.sh
+16
@@ -865,4 +865,20 @@ test_expect_success 'detect corrupt index file in fsck' '
865 test_i18ngrep "bad index file" errors
866 '
867
868 +test_expect_success 'fsck hard errors on an invalid object type' '
869 + git init --bare garbage-type &&
870 + (
871 + cd garbage-type &&
872 +
873 + git hash-object --stdin -w -t garbage --literally </dev/null &&
874 +
875 + cat >err.expect <<-\EOF &&
876 + fatal: invalid object type
877 + EOF
878 + test_must_fail git fsck >out 2>err &&
879 + test_cmp err.expect err &&
880 + test_must_be_empty out
881 + )
882 +'
883 +
884 test_done