All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add failing test: "fsck survives inflate errors"
@ 2014-07-20  4:43 Samuel Bronson
  2014-07-20 20:43 ` Samuel Bronson
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Bronson @ 2014-07-20  4:43 UTC (permalink / raw)
  To: git; +Cc: Samuel Bronson

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 <naesten@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-09  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-20  4:43 [PATCH] Add failing test: "fsck survives inflate errors" Samuel Bronson
2014-07-20 20:43 ` Samuel Bronson
2014-07-30  2:42   ` [BUG] parse_object() does not behave as documented Samuel Bronson
2014-08-09  5:43     ` Samuel Bronson
2014-08-09  6:53   ` [PATCH] Add failing test: "fsck survives inflate errors" Duy Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.