git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Santiago Torres <santiago@nyu.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>,
	git@vger.kernel.org, Jan Palus <jan.palus@gmail.com>
Subject: Re: [PATCH 3/3] t7004, t7030: fix here-doc syntax errors
Date: Thu, 23 Mar 2017 18:28:47 -0400	[thread overview]
Message-ID: <20170323222846.twxktig335o4r572@LykOS.localdomain> (raw)
In-Reply-To: <xmqqfui3ac2f.fsf@gitster.mtv.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 3959 bytes --]

On Thu, Mar 23, 2017 at 03:00:08PM -0700, Junio C Hamano wrote:
> Santiago Torres <santiago@nyu.edu> writes:
 
> OK, so has everybody agreed what the next step would be? 

I believe it is, although I imagine getting a confirmation from Peff
would be adequate.

> Is the patch below a good first step (I still need to get it signed
> off)?

I'm adding a signoff to the patch below.

Thanks,
-Santiago

-- >8 --
Subject: t7004, t7030: fix here-doc syntax errors
From: Santiago Torres <santiago@nyu.edu>

Jan Palus noticed that some here-doc are spelled incorrectly,
resulting the entire remainder of the test as if it were data
slurped into the "expect" file, e.g. in this sequence

	cat >expect <<EOF &&
	... expectation ...
	EOF
	git $cmd_being_tested >actual &&
	test_cmp expect actual

the last command of the test is "cat" that sends everything to
'expect' and succeeds.

Fixing these issues in t7004 and t7030 reveals that "git tag -v"
and "git verify-tag" with their --format option do not work as the
test was expecting originally.  Instead of showing both valid tags
and tags with incorrect signatures on their output, tags that do not
pass verification are omitted from the output.

Arguably, that is a safer behaviour, and because the format
specifiers like %(tag) do not have a way to show if the signature
verifies correctly, the command with the --format option cannot be
used to get a list of tags annotated with their signature validity
anyway.

For now, let's fix the here-doc syntax and update the expectation to
match the reality.  Maybe later when we extend the --format language
available to "git tag -v" and "git verify-tag" to include things
like "%(gpg:status)", we may want to change the behaviour so that
piping a list of tag names into

    xargs git verify-tag --format='%(gpg:status) %(tag)'

becomes a good way to produce such a list, but that is a separate
topic.

Signed-off-by: Santiago Torres <santiago@nyu.edu>
Noticed-by: Jan Palus <jan.palus@gmail.com>
Helped-by: Jeff King <peff@peff.net>
---
 t/t7004-tag.sh        | 10 ++++------
 t/t7030-verify-tag.sh | 10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index b4698ab5f5..0581053a06 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -896,17 +896,15 @@ test_expect_success GPG 'verifying a forged tag should fail' '
 '
 
 test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
-	cat >expect <<-\EOF
+	cat >expect <<-\EOF &&
 	tagname : signed-tag
-	EOF &&
+	EOF
 	git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
-	cat >expect <<-\EOF
-	tagname : forged-tag
-	EOF &&
+test_expect_success 'verifying a forged tag with --format should fail silently' '
+	>expect &&
 	test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index d62ccbb98e..79864a3411 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -126,17 +126,15 @@ test_expect_success GPG 'verify multiple tags' '
 '
 
 test_expect_success 'verifying tag with --format' '
-	cat >expect <<-\EOF
+	cat >expect <<-\EOF &&
 	tagname : fourth-signed
-	EOF &&
+	EOF
 	git verify-tag --format="tagname : %(tag)" "fourth-signed" >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
-	cat >expect <<-\EOF
-	tagname : 7th forged-signed
-	EOF &&
+test_expect_success 'verifying a forged tag with --format should fail silently' '
+	>expect &&
 	test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
 	test_cmp expect actual-forged
 '



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-03-23 22:28 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 17:35 EOF test fixes (t5615/t7004) Jan Palus
2017-03-22 18:28 ` EOF test fixes (t7030/t7406) Jan Palus
2017-03-22 18:47 ` EOF test fixes (t5615/t7004) Stefan Beller
2017-03-22 19:43 ` Junio C Hamano
2017-03-22 20:08 ` [PATCH 0/3] fix "here-doc" syntax errors Junio C Hamano
2017-03-22 20:08   ` [PATCH 1/3] t5615: fix a here-doc syntax error Junio C Hamano
2017-03-22 21:02     ` Jeff King
2017-03-22 20:08   ` [PATCH 2/3] t7406: fix here-doc syntax errors Junio C Hamano
2017-03-22 21:07     ` Jeff King
2017-03-22 21:32       ` Stefan Beller
2017-03-22 21:39         ` Jeff King
2017-03-22 21:49           ` [PATCH] t7406: correct test case for submodule-update initial population Stefan Beller
2017-03-22 21:59             ` Jeff King
2017-03-22 22:07               ` Stefan Beller
2017-03-22 22:09                 ` Jeff King
2017-03-22 22:14                 ` Jonathan Nieder
2017-03-22 22:12               ` Junio C Hamano
2017-03-22 22:24                 ` Jeff King
2017-03-22 22:28                   ` Stefan Beller
2017-03-22 21:34       ` [PATCH 2/3] t7406: fix here-doc syntax errors Junio C Hamano
2017-03-22 20:08   ` [PATCH 3/3] t7004, t7030: " Junio C Hamano
2017-03-22 21:10     ` Jeff King
2017-03-22 21:43       ` Santiago Torres
2017-03-22 22:04         ` Jeff King
2017-03-22 22:04       ` Junio C Hamano
2017-03-22 22:15         ` Santiago Torres
2017-03-22 22:22           ` Jeff King
2017-03-22 22:34             ` Santiago Torres
2017-03-22 22:41               ` Jeff King
2017-03-22 22:47                 ` Junio C Hamano
2017-03-22 22:51                 ` Santiago Torres
2017-03-23 22:00                   ` Junio C Hamano
2017-03-23 22:28                     ` Santiago Torres [this message]
2017-03-23 23:49                     ` Jeff King
2017-03-24 16:45                       ` Junio C Hamano
2017-03-24 16:49                         ` Jeff King
2017-03-24 18:00                           ` Jeff King
2017-03-24 18:04                           ` Junio C Hamano
2017-03-24 18:16                             ` Jeff King
2017-03-22 22:38             ` Junio C Hamano
2017-03-22 22:40   ` [PATCH 0/3] fix "here-doc" " Jan Palus
2017-03-23  2:12   ` [PATCH] tests: lint for run-away here-doc Junio C Hamano
2017-03-23  5:43     ` [PATCH v2] " Junio C Hamano
2017-03-24  1:29       ` Jonathan Nieder
2017-03-24  2:45         ` Junio C Hamano
2017-03-24  3:59       ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170323222846.twxktig335o4r572@LykOS.localdomain \
    --to=santiago@nyu.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jan.palus@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).