On Thu, Sep 30 2021, Andrei Rybak wrote: > On 30/09/2021 15:37, Ævar Arnfjörð Bjarmason wrote: >> 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@xxxxxxxxx> >> --- >> t/t1450-fsck.sh | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh >> index 5071ac63a5b..969bfbbdd8f 100755 >> --- a/t/t1450-fsck.sh >> +++ b/t/t1450-fsck.sh >> @@ -865,4 +865,21 @@ 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 && >> + >> + empty=$(git hash-object --stdin -w -t blob </dev/null) && >> + garbage=$(git hash-object --stdin -w -t garbage --literally </dev/null) && > > Patch 01/17 introduces two unused variables: "garbage" and "empty". > However, patch 16/17 introduces grep checks for "garbage_blob" and > "empty_blob". Aside from that, 't/test-lib.sh' already defines > $EMPTY_BLOB. Will fix in the v10 re-roll. I think this is from an earlier version where I used the $empty, FWIW you do need it (or to write it) even with $EMPTY_BLOB since that's just the OID, but doesn't give you the object. You can write the /dev/null input and then use $EMPTY_BLOB, but I thought using the output of hash-object was less confusing. But in any case it isn't needed herea as you point out, we just need to write the garbage object, we don't need either variable. Thanks!