[PATCH] Add failing test: "fsck survives inflate errors"
From: Samuel Bronson <hidden>
Date: 2016-06-15 23:01:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
While inflate errors are obviously NOT GOOD, and should perhaps be fatal for most commands, git fsck is something of a special case because it is useful to have *it* report as many corrupt objects as possible in one run. Signed-off-by: Samuel Bronson <redacted> --- t/t1450-fsck.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 8c739c9..6dcc4b2 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh@@ -53,6 +53,23 @@ test_expect_success 'setup: helpers for corruption tests' ' } ' +# git fsck should be able to detect more than one corrupt object per run +test_expect_failure 'fsck survives inflate errors' ' + hash1=ffffffffffffffffffffffffffffffffffffffff && + hash2=fffffffffffffffffffffffffffffffffffffffe && + mkdir -p .git/objects/ff && + echo not-zlib >$(sha1_file $hash1) && + test_when_finished "remove_object $hash1" && + echo not-zlib >$(sha1_file $hash2) && + test_when_finished "remove_object $hash2" && + + # Return value is not documented + test_might_fail git fsck 2>out && + cat out && echo ====== && + grep "$hash1.*corrupt" out && + grep "$hash2.*corrupt" out +' + test_expect_success 'object with bad sha1' ' sha=$(echo blob | git hash-object -w --stdin) && old=$(echo $sha | sed "s+^..+&/+") &&
--
2.0.1