From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t5530-upload-pack-error: Check more carefully for failures.
Date: Mon, 05 Nov 2007 16:22:17 -0800 [thread overview]
Message-ID: <7vve8gkyti.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200711052240.12822.johannes.sixt@telecom.at> (Johannes Sixt's message of "Mon, 5 Nov 2007 22:40:12 +0100")
Johannes Sixt <johannes.sixt@telecom.at> writes:
> On Monday 05 November 2007 21:05, Junio C Hamano wrote:
> > > The test case checks for failures in rev-list (a missing
> > > object). Any hints how to trigger a failure in pack-objects
> > > that does not also trigger in rev-list would be welcome.
> >
> > How about removing a blob from the test repository to corrupt
> > it? rev-list --objects I think would happily list the blob
> > because it sees its name in its containing tree without checking
> > its existence.
>
> That does it. This goes on top of my previous patch.
Thanks. Will squash with further changes attached for readability.
---
t/t5530-upload-pack-error.sh | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 70d4f86..cc8949e 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -6,6 +6,13 @@ test_description='errors in upload-pack'
D=`pwd`
+corrupt_repo () {
+ object_sha1=$(git rev-parse "$1") &&
+ ob=$(expr "$object_sha1" : "\(..\)") &&
+ ject=$(expr "$object_sha1" : "..\(..*\)") &&
+ rm -f ".git/objects/$ob/$ject"
+}
+
test_expect_success 'setup and corrupt repository' '
echo file >file &&
@@ -15,7 +22,7 @@ test_expect_success 'setup and corrupt repository' '
test_tick &&
echo changed >file &&
git commit -a -m changed &&
- rm -f .git/objects/5e/a2ed416fbd4a4cbe227b75fe255dd7fa6bd4d6
+ corrupt_repo HEAD:file
'
@@ -35,7 +42,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects' '
test_expect_success 'corrupt repo differently' '
git hash-object -w file &&
- rm -f .git/objects/be/c63e37d08c454ad3a60cde90b70f3f7d077852
+ corrupt_repo HEAD^^{tree}
'
prev parent reply other threads:[~2007-11-06 0:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-04 19:46 [PATCH] upload-pack: Use finish_{command,async}() instead of waitpid() Johannes Sixt
2007-11-05 1:42 ` Michael J. Cohen
2007-11-05 20:05 ` Junio C Hamano
2007-11-05 21:40 ` [PATCH] t5530-upload-pack-error: Check more carefully for failures Johannes Sixt
2007-11-06 0:22 ` Junio C Hamano [this message]
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=7vve8gkyti.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.sixt@telecom.at \
/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).