Skip to content

Commit 618310a

Browse files
sunshinecogitster
authored andcommitted
t6302: skip only signed tags rather than all tests when GPG is missing
The primary purpose of these tests is to check filtering, sorting, and formatting behavior of git-for-each-ref, so it is unfortunate that the entire test script is skipped when GPG is not present. Rather than skipping all tests, let's instead just skip testing against signed tags when GPG is missing. Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7bc734e commit 618310a

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

t/t6302-for-each-ref-filter.sh

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ test_description='test for-each-refs usage of ref-filter APIs'
55
. ./test-lib.sh
66
. "$TEST_DIRECTORY"/lib-gpg.sh
77

8-
if ! test_have_prereq GPG
9-
then
10-
skip_all="skipping for-each-ref tests, GPG not available"
11-
test_done
12-
fi
8+
test_prepare_expect () {
9+
if test_have_prereq GPG
10+
then
11+
cat
12+
else
13+
sed '/signed/d'
14+
fi
15+
}
1316

1417
test_expect_success 'setup some history and refs' '
1518
test_commit one &&
@@ -19,8 +22,11 @@ test_expect_success 'setup some history and refs' '
1922
test_commit four &&
2023
git tag -m "An annotated tag" annotated-tag &&
2124
git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag &&
22-
git tag -s -m "A signed tag" signed-tag &&
23-
git tag -s -m "Signed doubly" doubly-signed-tag signed-tag &&
25+
if test_have_prereq GPG
26+
then
27+
git tag -s -m "A signed tag" signed-tag &&
28+
git tag -s -m "Signed doubly" doubly-signed-tag signed-tag
29+
fi &&
2430
git checkout master &&
2531
git update-ref refs/odd/spot master
2632
'
@@ -36,7 +42,7 @@ test_expect_success 'filtering with --points-at' '
3642
'
3743

3844
test_expect_success 'check signed tags with --points-at' '
39-
sed -e "s/Z$//" >expect <<-\EOF &&
45+
test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect &&
4046
refs/heads/side Z
4147
refs/tags/annotated-tag four
4248
refs/tags/four Z
@@ -59,7 +65,7 @@ test_expect_success 'filtering with --merged' '
5965
'
6066

6167
test_expect_success 'filtering with --no-merged' '
62-
cat >expect <<-\EOF &&
68+
test_prepare_expect >expect <<-\EOF &&
6369
refs/heads/side
6470
refs/tags/annotated-tag
6571
refs/tags/doubly-annotated-tag
@@ -72,7 +78,7 @@ test_expect_success 'filtering with --no-merged' '
7278
'
7379

7480
test_expect_success 'filtering with --contains' '
75-
cat >expect <<-\EOF &&
81+
test_prepare_expect >expect <<-\EOF &&
7682
refs/heads/master
7783
refs/heads/side
7884
refs/odd/spot
@@ -93,7 +99,7 @@ test_expect_success '%(color) must fail' '
9399
'
94100

95101
test_expect_success 'left alignment is default' '
96-
cat >expect <<-\EOF &&
102+
test_prepare_expect >expect <<-\EOF &&
97103
refname is refs/heads/master |refs/heads/master
98104
refname is refs/heads/side |refs/heads/side
99105
refname is refs/odd/spot |refs/odd/spot
@@ -111,7 +117,7 @@ test_expect_success 'left alignment is default' '
111117
'
112118

113119
test_expect_success 'middle alignment' '
114-
cat >expect <<-\EOF &&
120+
test_prepare_expect >expect <<-\EOF &&
115121
| refname is refs/heads/master |refs/heads/master
116122
| refname is refs/heads/side |refs/heads/side
117123
| refname is refs/odd/spot |refs/odd/spot
@@ -129,7 +135,7 @@ test_expect_success 'middle alignment' '
129135
'
130136

131137
test_expect_success 'right alignment' '
132-
cat >expect <<-\EOF &&
138+
test_prepare_expect >expect <<-\EOF &&
133139
| refname is refs/heads/master|refs/heads/master
134140
| refname is refs/heads/side|refs/heads/side
135141
| refname is refs/odd/spot|refs/odd/spot
@@ -146,7 +152,7 @@ test_expect_success 'right alignment' '
146152
test_cmp expect actual
147153
'
148154

149-
cat >expect <<-\EOF
155+
test_prepare_expect >expect <<-\EOF
150156
| refname is refs/heads/master |refs/heads/master
151157
| refname is refs/heads/side |refs/heads/side
152158
| refname is refs/odd/spot |refs/odd/spot
@@ -193,7 +199,7 @@ EOF
193199
# Individual atoms inside %(align:...) and %(end) must not be quoted.
194200

195201
test_expect_success 'alignment with format quote' "
196-
cat >expect <<-\EOF &&
202+
test_prepare_expect >expect <<-\EOF &&
197203
|' '\''master| A U Thor'\'' '|
198204
|' '\''side| A U Thor'\'' '|
199205
|' '\''odd/spot| A U Thor'\'' '|
@@ -211,7 +217,7 @@ test_expect_success 'alignment with format quote' "
211217
"
212218

213219
test_expect_success 'nested alignment with quote formatting' "
214-
cat >expect <<-\EOF &&
220+
test_prepare_expect >expect <<-\EOF &&
215221
|' master '|
216222
|' side '|
217223
|' odd/spot '|
@@ -229,7 +235,7 @@ test_expect_success 'nested alignment with quote formatting' "
229235
"
230236

231237
test_expect_success 'check `%(contents:lines=1)`' '
232-
cat >expect <<-\EOF &&
238+
test_prepare_expect >expect <<-\EOF &&
233239
master |three
234240
side |four
235241
odd/spot |three
@@ -247,7 +253,7 @@ test_expect_success 'check `%(contents:lines=1)`' '
247253
'
248254

249255
test_expect_success 'check `%(contents:lines=0)`' '
250-
cat >expect <<-\EOF &&
256+
test_prepare_expect >expect <<-\EOF &&
251257
master |
252258
side |
253259
odd/spot |
@@ -265,7 +271,7 @@ test_expect_success 'check `%(contents:lines=0)`' '
265271
'
266272

267273
test_expect_success 'check `%(contents:lines=99999)`' '
268-
cat >expect <<-\EOF &&
274+
test_prepare_expect >expect <<-\EOF &&
269275
master |three
270276
side |four
271277
odd/spot |three

0 commit comments

Comments
 (0)