From: Andrei Rybak <rybak.a.v@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Olga Telezhnaya <olyatelezhnaya@gmail.com>,
Jeff King <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH 3/6] mktag tests: test hash-object --literally and unreachable fsck
Date: Tue, 15 Jun 2021 12:34:09 +0200 [thread overview]
Message-ID: <6148debe-fc44-67b7-ac9c-f27d376bc9f2@gmail.com> (raw)
In-Reply-To: <patch-3.6-96520b3e89a-20210614T172422Z-avarab@gmail.com>
On 14/06/2021 19:28, Ævar Arnfjörð Bjarmason wrote:
> Extend the mktag tests to pass the tag we've created through both
> hash-object --literally and fsck.
>
> This checks that fsck itself will not complain about certain invalid
> content if a reachable tip isn't involved. Due to how fsck works and
> walks the graph the failure will be different if the object is
> reachable, so we might succeed before we've created the ref.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> t/t3800-mktag.sh | 48 +++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 39 insertions(+), 9 deletions(-)
>
> diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
> index 951e6d39c2a..43b67a149f8 100755
> --- a/t/t3800-mktag.sh
> +++ b/t/t3800-mktag.sh
> @@ -16,6 +16,8 @@ check_verify_failure () {
> message=$2 &&
> shift 2 &&
>
> + no_strict= &&
> + fsck_obj_ok= &&
> no_strict= &&
> while test $# != 0
> do
> @@ -23,7 +25,10 @@ check_verify_failure () {
> --no-strict)
> no_strict=yes
> ;;
> - esac &&
> + --fsck-obj-ok)
> + fsck_obj_ok=yes
> + ;;
> + esac
"&&" after "esac" got removed.
> shift
> done &&
>
> @@ -37,6 +42,23 @@ check_verify_failure () {
> git mktag --no-strict <tag.sig
> fi
> '
> +
> + test_expect_success "setup: $subject" '
> + # Reset any leftover state from the last $subject
> + rm -rf bad-tag &&
> +
> + git init --bare bad-tag &&
> + git -C bad-tag hash-object -t tag -w --stdin --literally <tag.sig
> + '
> +
> + test_expect_success "hash-object & fsck unreachable: $subject" '
> + if test -n "$fsck_obj_ok"
> + then
> + git -C bad-tag fsck
> + else
> + test_must_fail git -C bad-tag fsck >out 2>err
This is the very end of the check_verify_failure function. It seems
that after "out" and "err" are created here, nothing else checks their
contents.
> + fi
> + '
> }
>
> test_expect_mktag_success() {
> @@ -183,7 +205,8 @@ tagger . <> 0 +0000
> EOF
>
> check_verify_failure 'verify object (hash/type) check -- correct type, nonexisting object' \
> - '^fatal: could not read tagged object'
> + '^fatal: could not read tagged object' \
> + --fsck-obj-ok
>
> cat >tag.sig <<EOF
> object $head
> @@ -216,7 +239,8 @@ tagger . <> 0 +0000
> EOF
>
> check_verify_failure 'verify object (hash/type) check -- mismatched type, valid object' \
> - '^fatal: object.*tagged as.*tree.*but is.*commit'
> + '^fatal: object.*tagged as.*tree.*but is.*commit' \
> + --fsck-obj-ok
>
> ############################################################
> # 9.5. verify object (hash/type) check -- replacement
> @@ -245,7 +269,8 @@ tagger . <> 0 +0000
> EOF
>
> check_verify_failure 'verify object (hash/type) check -- mismatched type, valid object' \
> - '^fatal: object.*tagged as.*tree.*but is.*blob'
> + '^fatal: object.*tagged as.*tree.*but is.*blob' \
> + --fsck-obj-ok
>
> ############################################################
> # 10. verify tag-name check
> @@ -260,7 +285,8 @@ EOF
>
> check_verify_failure 'verify tag-name check' \
> '^error:.* badTagName:' \
> - --no-strict
> + --no-strict \
> + --fsck-obj-ok
>
> ############################################################
> # 11. tagger line label check #1
> @@ -275,7 +301,8 @@ EOF
>
> check_verify_failure '"tagger" line label check #1' \
> '^error:.* missingTaggerEntry:' \
> - --no-strict
> + --no-strict \
> + --fsck-obj-ok
>
> ############################################################
> # 12. tagger line label check #2
> @@ -291,7 +318,8 @@ EOF
>
> check_verify_failure '"tagger" line label check #2' \
> '^error:.* missingTaggerEntry:' \
> - --no-strict
> + --no-strict \
> + --fsck-obj-ok
>
> ############################################################
> # 13. allow missing tag author name like fsck
> @@ -321,7 +349,8 @@ EOF
>
> check_verify_failure 'disallow malformed tagger' \
> '^error:.* badEmail:' \
> - --no-strict
> + --no-strict \
> + --fsck-obj-ok
>
> ############################################################
> # 15. allow empty tag email
> @@ -446,7 +475,8 @@ EOF
>
> check_verify_failure 'detect invalid header entry' \
> '^error:.* extraHeaderEntry:' \
> - --no-strict
> + --no-strict \
> + --fsck-obj-ok
>
> test_expect_success 'invalid header entry config & fsck' '
> test_must_fail git mktag <tag.sig &&
>
next prev parent reply other threads:[~2021-06-15 10:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 17:28 [PATCH 0/6] mktag tests: test more exhaustively Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 1/6] mktag tests: parse out options in helper Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-15 10:34 ` Andrei Rybak [this message]
2021-06-15 14:41 ` Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 5/6] mktag tests: test for-each-ref Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason
2021-06-15 3:06 ` [PATCH 0/6] mktag tests: test more exhaustively Junio C Hamano
2021-06-17 10:41 ` [PATCH v2 " Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 1/6] mktag tests: parse out options in helper Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-17 10:41 ` [PATCH v2 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 5/6] mktag tests: test for-each-ref Ævar Arnfjörð Bjarmason
2021-06-17 10:42 ` [PATCH v2 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason
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=6148debe-fc44-67b7-ac9c-f27d376bc9f2@gmail.com \
--to=rybak.a.v@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=olyatelezhnaya@gmail.com \
--cc=peff@peff.net \
/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).