From: Samuel Bronson <naesten@gmail.com>
To: git@vger.kernel.org
Cc: Samuel Bronson <naesten@gmail.com>
Subject: [PATCH] Add failing test: "fsck survives inflate errors"
Date: Sun, 20 Jul 2014 00:43:03 -0400 [thread overview]
Message-ID: <1405831383-22477-1-git-send-email-naesten@gmail.com> (raw)
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
next reply other threads:[~2014-07-20 4:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-20 4:43 Samuel Bronson [this message]
2014-07-20 20:43 ` [PATCH] Add failing test: "fsck survives inflate errors" 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405831383-22477-1-git-send-email-naesten@gmail.com \
--to=naesten@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).