[PATCH v10 01/17] fsck tests: add test for fsck-ing an unknown type
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 1, 2021, 09:16 UTC
- Message-ID
- <patch-v10-01.17-00936435423-20211001T091051Z-avarab@gmail.com>
- In-Reply-To
- <cover-v10-00.17-00000000000-20211001T091051Z-avarab@gmail.com>
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> --- t/t1450-fsck.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 5071ac63a5b..beb233e91b1 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
-- 2.33.0.1375.g5eed55aa1b5