From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Johannes Sixt <j6t@kdbg.org>, git@vger.kernel.org
Subject: Re: [PATCH v5] Test fsck a bit harder
Date: Mon, 02 Mar 2009 23:31:06 -0800 [thread overview]
Message-ID: <7v3advgj0l.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1235946763-15252-1-git-send-email-trast@student.ethz.ch> (Thomas Rast's message of "Sun, 1 Mar 2009 23:32:43 +0100")
Thomas Rast <trast@student.ethz.ch> writes:
> Johannes Sixt wrote:
>> This is wrong: It does not test the exist status. In a pipeline, the shell
>> looks only at the exit status of the last command. You really want this as
>>
>> test_must_fail git fsck >out 2>&1 &&
>
> You're right.
And you still write this after the lesson?
> +test_expect_success 'branch pointing to non-commit' '
> + git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
> + git fsck 2>&1 | tee out &&
> + grep "not a commit" out
> +'
> +git update-ref -d refs/heads/invalid
> +
> +cat > invalid-tag <<EOF
> +object ffffffffffffffffffffffffffffffffffffffff
> +type commit
> +tag invalid
> +tagger T A Gger <tagger@example.com> 1234567890 -0000
> +
> +This is an invalid tag.
> +EOF
Technically speaking, the tag is perfectly valid. It just points to a
commit you do not have.
> +cat > wrong-tag <<EOF
> +object $(echo blob | git hash-object -w --stdin)
> +type commit
> +tag wrong
> +tagger T A Gger <tagger@example.com> 1234567890 -0000
> +
> +This is an invalid tag.
> +EOF
This is indeed invalid.
> +test_expect_success 'tag pointing to something else than its type' '
> + tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
> + echo $tag > .git/refs/tags/wrong &&
> + test_must_fail git fsck >out 2>&1 &&
> + grep "Object.*is a blob, not a commit" out
> +'
> +
> +rm .git/refs/tags/wrong
I'd rather want to see test_expect_success around this "rm", and replace
that rm with something more git-ish, like "tag -d" or "update-ref -d".
By the way, is it just me or would we want to reword the subject of the
commit to tame it a little bit?
next prev parent reply other threads:[~2009-03-03 7:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-19 1:42 What's cooking in git.git (Feb 2009, #06; Wed, 18) Junio C Hamano
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
2009-02-19 11:13 ` [PATCH v2 1/8] " Thomas Rast
2009-02-19 11:13 ` [PATCH v2 2/8] Test that diff can read from stdin Thomas Rast
2009-02-19 11:13 ` [PATCH v2 3/8] Test diff --dirstat functionality Thomas Rast
2009-02-19 11:13 ` [PATCH v2 4/8] Test log --graph Thomas Rast
2009-02-19 11:13 ` [PATCH v2 5/8] Test fsck a bit harder Thomas Rast
2009-02-20 19:40 ` [PATCH v3] " Thomas Rast
2009-02-20 20:29 ` Johannes Sixt
2009-02-21 11:25 ` [PATCH v4] " Thomas Rast
2009-02-21 19:21 ` Johannes Sixt
2009-03-01 22:32 ` [PATCH v5] " Thomas Rast
2009-03-03 7:31 ` Junio C Hamano [this message]
2009-02-19 11:13 ` [PATCH v2 6/8] Test log --decorate Thomas Rast
2009-02-19 11:13 ` [PATCH v2 7/8] Test rev-list --parents/--children Thomas Rast
2009-02-19 11:13 ` [PATCH v2 8/8] Test git-patch-id Thomas Rast
2009-02-19 13:46 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Johannes Schindelin
2009-02-19 14:11 ` Thomas Rast
2009-02-19 14:09 ` Sverre Rabbelier
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=7v3advgj0l.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=trast@student.ethz.ch \
/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).