Skip to content

Commit 093fffd

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 107691c commit 093fffd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t1450-fsck.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,4 +865,20 @@ test_expect_success 'detect corrupt index file in fsck' '
865865
test_i18ngrep "bad index file" errors
866866
'
867867

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+
868884
test_done

0 commit comments

Comments
 (0)