From: Ævar Arnfjörð Bjarmason Date: Fri, 1 Oct 2021 09:16:40 +0000 (+0200) Subject: fsck tests: test for garbage appended to a loose object X-Git-Tag: v2.34.0-rc0~43^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5ed333121bde3e170e5497d30391671a9910fb0;p=thirdparty%2Fgit.git fsck tests: test for garbage appended to a loose object There wasn't any output tests for this scenario, let's ensure that we don't regress on it in the changes that come after this. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index f9cabcecd1..281ff8bdd8 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -93,6 +93,26 @@ test_expect_success 'object with hash and type mismatch' ' ) ' +test_expect_success POSIXPERM 'zlib corrupt loose object output ' ' + git init --bare corrupt-loose-output && + ( + cd corrupt-loose-output && + oid=$(git hash-object -w --stdin --literally >$oidf && + + cat >expect.error <<-EOF && + error: garbage at end of loose object '\''$oid'\'' + error: unable to unpack contents of ./$oidf + error: $oid: object corrupt or missing: ./$oidf + EOF + test_must_fail git fsck 2>actual && + grep ^error: actual >error && + test_cmp expect.error error + ) +' + test_expect_success 'branch pointing to non-commit' ' git rev-parse HEAD^{tree} >.git/refs/heads/invalid && test_when_finished "git update-ref -d refs/heads/invalid" &&