git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	git@vger.kernel.org, Karthik Nayak <karthik.188@gmail.com>
Subject: Re: [PATCH] t6302: drop unnecessary GPG requirement
Date: Mon, 1 Feb 2016 08:24:34 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1602010759480.2964@virtualbox> (raw)
In-Reply-To: <xmqq4mdtxjxf.fsf@gitster.mtv.corp.google.com>

Hi Eric & Junio,

On Sun, 31 Jan 2016, Junio C Hamano wrote:

> Eric Sunshine <sunshine@sunshineco.com> writes:
> 
> > These tests are concerned specifically with filtering, sorting,
> > formatting behavior of git-for-each-ref, yet if GPG is not present,
> > the entire test script is skipped even though none of the tests depend
> > upon or care whether the tags are signed. This unnecessary dependency
> > upon GPG may prevent these tests from being more widely run, so drop
> > it.
> 
> [...]
>
> Would it make sense to introduce a helper function specific to this
> script to be used to prepare the expected output, to replace cat <<,
> that goes like this?
> 
> [...]

An even easier solution might be to *not* set up the signed tags in the
'setup' part, but only in the respective test case, and delete them right
away after said test case?

Something like this (I even tested this with and without the GPG prereq):

-- snipsnap --
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] Do not make t6302 depend on gpg wholesale

There is but a single test case, in fact, that depends on gpg. Let's just
make the other test cases independent of gpg and add the GPG prereq to
said single test case.

Noticed by Eric Sunshine.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t6302-for-each-ref-filter.sh | 33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index fe4796c..e3a5636 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -5,20 +5,12 @@ test_description='test for-each-refs usage of ref-filter APIs'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-gpg.sh
 
-if ! test_have_prereq GPG
-then
-	skip_all="skipping for-each-ref tests, GPG not available"
-	test_done
-fi
-
 test_expect_success 'setup some history and refs' '
 	test_commit one &&
 	test_commit two &&
 	test_commit three &&
 	git checkout -b side &&
 	test_commit four &&
-	git tag -s -m "A signed tag message" signed-tag &&
-	git tag -s -m "Annonated doubly" double-tag signed-tag &&
 	git checkout master &&
 	git update-ref refs/odd/spot master
 '
@@ -33,7 +25,10 @@ test_expect_success 'filtering with --points-at' '
 	test_cmp expect actual
 '
 
-test_expect_success 'check signed tags with --points-at' '
+test_expect_success GPG 'check signed tags with --points-at' '
+	git tag -s -m "A signed tag message" signed-tag side &&
+	git tag -s -m "Annonated doubly" double-tag signed-tag &&
+	test_when_finished git tag -d signed-tag &&
 	sed -e "s/Z$//" >expect <<-\EOF &&
 	refs/heads/side Z
 	refs/tags/four Z
@@ -58,9 +53,7 @@ test_expect_success 'filtering with --merged' '
 test_expect_success 'filtering with --no-merged' '
 	cat >expect <<-\EOF &&
 	refs/heads/side
-	refs/tags/double-tag
 	refs/tags/four
-	refs/tags/signed-tag
 	EOF
 	git for-each-ref --format="%(refname)" --no-merged=master >actual &&
 	test_cmp expect actual
@@ -71,9 +64,7 @@ test_expect_success 'filtering with --contains' '
 	refs/heads/master
 	refs/heads/side
 	refs/odd/spot
-	refs/tags/double-tag
 	refs/tags/four
-	refs/tags/signed-tag
 	refs/tags/three
 	refs/tags/two
 	EOF
@@ -90,10 +81,8 @@ test_expect_success 'left alignment is default' '
 	refname is refs/heads/master  |refs/heads/master
 	refname is refs/heads/side    |refs/heads/side
 	refname is refs/odd/spot      |refs/odd/spot
-	refname is refs/tags/double-tag|refs/tags/double-tag
 	refname is refs/tags/four     |refs/tags/four
 	refname is refs/tags/one      |refs/tags/one
-	refname is refs/tags/signed-tag|refs/tags/signed-tag
 	refname is refs/tags/three    |refs/tags/three
 	refname is refs/tags/two      |refs/tags/two
 	EOF
@@ -106,10 +95,8 @@ test_expect_success 'middle alignment' '
 	| refname is refs/heads/master |refs/heads/master
 	|  refname is refs/heads/side  |refs/heads/side
 	|   refname is refs/odd/spot   |refs/odd/spot
-	|refname is refs/tags/double-tag|refs/tags/double-tag
 	|  refname is refs/tags/four   |refs/tags/four
 	|   refname is refs/tags/one   |refs/tags/one
-	|refname is refs/tags/signed-tag|refs/tags/signed-tag
 	|  refname is refs/tags/three  |refs/tags/three
 	|   refname is refs/tags/two   |refs/tags/two
 	EOF
@@ -122,10 +109,8 @@ test_expect_success 'right alignment' '
 	|  refname is refs/heads/master|refs/heads/master
 	|    refname is refs/heads/side|refs/heads/side
 	|      refname is refs/odd/spot|refs/odd/spot
-	|refname is refs/tags/double-tag|refs/tags/double-tag
 	|     refname is refs/tags/four|refs/tags/four
 	|      refname is refs/tags/one|refs/tags/one
-	|refname is refs/tags/signed-tag|refs/tags/signed-tag
 	|    refname is refs/tags/three|refs/tags/three
 	|      refname is refs/tags/two|refs/tags/two
 	EOF
@@ -140,10 +125,8 @@ test_expect_success 'alignment with format quote' "
 	|'      '\''master| A U Thor'\''      '|
 	|'       '\''side| A U Thor'\''       '|
 	|'     '\''odd/spot| A U Thor'\''     '|
-	|'        '\''double-tag| '\''        '|
 	|'       '\''four| A U Thor'\''       '|
 	|'       '\''one| A U Thor'\''        '|
-	|'        '\''signed-tag| '\''        '|
 	|'      '\''three| A U Thor'\''       '|
 	|'       '\''two| A U Thor'\''        '|
 	EOF
@@ -156,10 +139,8 @@ test_expect_success 'nested alignment with quote formatting' "
 	|'         master               '|
 	|'           side               '|
 	|'       odd/spot               '|
-	|'     double-tag               '|
 	|'           four               '|
 	|'            one               '|
-	|'     signed-tag               '|
 	|'          three               '|
 	|'            two               '|
 	EOF
@@ -172,10 +153,8 @@ test_expect_success 'check `%(contents:lines=1)`' '
 	master |three
 	side |four
 	odd/spot |three
-	double-tag |Annonated doubly
 	four |four
 	one |one
-	signed-tag |A signed tag message
 	three |three
 	two |two
 	EOF
@@ -188,10 +167,8 @@ test_expect_success 'check `%(contents:lines=0)`' '
 	master |
 	side |
 	odd/spot |
-	double-tag |
 	four |
 	one |
-	signed-tag |
 	three |
 	two |
 	EOF
@@ -204,10 +181,8 @@ test_expect_success 'check `%(contents:lines=99999)`' '
 	master |three
 	side |four
 	odd/spot |three
-	double-tag |Annonated doubly
 	four |four
 	one |one
-	signed-tag |A signed tag message
 	three |three
 	two |two
 	EOF
-- 
2.7.0.windows.1.7.g55a05c8

  reply	other threads:[~2016-02-01  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-31 20:19 [PATCH] t6302: drop unnecessary GPG requirement Eric Sunshine
2016-02-01  2:07 ` Junio C Hamano
2016-02-01  7:24   ` Johannes Schindelin [this message]
2016-02-01 18:58     ` Junio C Hamano
2016-02-02  7:06       ` Johannes Schindelin

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=alpine.DEB.2.20.1602010759480.2964@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    --cc=sunshine@sunshineco.com \
    /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).