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 <gitster@pobox.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Mar 6, 2016 at 19:10 UTC
618310a3df8ddcbb33114c56b659056843c06626
1 file changed
+25
-19
t/t6302-for-each-ref-filter.sh
+25
-19
@@ -5,11 +5,14 @@ test_description='test for-each-refs usage of ref-filter APIs'
5
. ./test-lib.sh
6
. "$TEST_DIRECTORY"/lib-gpg.sh
7
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
+}
16
17
test_expect_success 'setup some history and refs' '
18
test_commit one &&
@@ -19,8 +22,11 @@ test_expect_success 'setup some history and refs' '
22
test_commit four &&
23
git tag -m "An annotated tag" annotated-tag &&
24
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 &&
30
git checkout master &&
31
git update-ref refs/odd/spot master
32
'
@@ -36,7 +42,7 @@ test_expect_success 'filtering with --points-at' '
42
'
43
44
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 &&
46
refs/heads/side Z
47
refs/tags/annotated-tag four
48
refs/tags/four Z
@@ -59,7 +65,7 @@ test_expect_success 'filtering with --merged' '
65
'
66
67
test_expect_success 'filtering with --no-merged' '
62
- cat >expect <<-\EOF &&
68
+ test_prepare_expect >expect <<-\EOF &&
69
refs/heads/side
70
refs/tags/annotated-tag
71
refs/tags/doubly-annotated-tag
@@ -72,7 +78,7 @@ test_expect_success 'filtering with --no-merged' '
78
'
79
80
test_expect_success 'filtering with --contains' '
75
- cat >expect <<-\EOF &&
81
+ test_prepare_expect >expect <<-\EOF &&
82
refs/heads/master
83
refs/heads/side
84
refs/odd/spot
@@ -93,7 +99,7 @@ test_expect_success '%(color) must fail' '
99
'
100
101
test_expect_success 'left alignment is default' '
96
- cat >expect <<-\EOF &&
102
+ test_prepare_expect >expect <<-\EOF &&
103
refname is refs/heads/master |refs/heads/master
104
refname is refs/heads/side |refs/heads/side
105
refname is refs/odd/spot |refs/odd/spot
@@ -111,7 +117,7 @@ test_expect_success 'left alignment is default' '
117
'
118
119
test_expect_success 'middle alignment' '
114
- cat >expect <<-\EOF &&
120
+ test_prepare_expect >expect <<-\EOF &&
121
| refname is refs/heads/master |refs/heads/master
122
| refname is refs/heads/side |refs/heads/side
123
| refname is refs/odd/spot |refs/odd/spot
@@ -129,7 +135,7 @@ test_expect_success 'middle alignment' '
135
'
136
137
test_expect_success 'right alignment' '
132
- cat >expect <<-\EOF &&
138
+ test_prepare_expect >expect <<-\EOF &&
139
| refname is refs/heads/master|refs/heads/master
140
| refname is refs/heads/side|refs/heads/side
141
| refname is refs/odd/spot|refs/odd/spot
@@ -146,7 +152,7 @@ test_expect_success 'right alignment' '
152
test_cmp expect actual
153
'
154
149
-cat >expect <<-\EOF
155
+test_prepare_expect >expect <<-\EOF
156
| refname is refs/heads/master |refs/heads/master
157
| refname is refs/heads/side |refs/heads/side
158
| refname is refs/odd/spot |refs/odd/spot
@@ -193,7 +199,7 @@ EOF
199
# Individual atoms inside %(align:...) and %(end) must not be quoted.
200
201
test_expect_success 'alignment with format quote' "
196
- cat >expect <<-\EOF &&
202
+ test_prepare_expect >expect <<-\EOF &&
203
|' '\''master| A U Thor'\'' '|
204
|' '\''side| A U Thor'\'' '|
205
|' '\''odd/spot| A U Thor'\'' '|
@@ -211,7 +217,7 @@ test_expect_success 'alignment with format quote' "
217
"
218
219
test_expect_success 'nested alignment with quote formatting' "
214
- cat >expect <<-\EOF &&
220
+ test_prepare_expect >expect <<-\EOF &&
221
|' master '|
222
|' side '|
223
|' odd/spot '|
@@ -229,7 +235,7 @@ test_expect_success 'nested alignment with quote formatting' "
235
"
236
237
test_expect_success 'check `%(contents:lines=1)`' '
232
- cat >expect <<-\EOF &&
238
+ test_prepare_expect >expect <<-\EOF &&
239
master |three
240
side |four
241
odd/spot |three
@@ -247,7 +253,7 @@ test_expect_success 'check `%(contents:lines=1)`' '
253
'
254
255
test_expect_success 'check `%(contents:lines=0)`' '
250
- cat >expect <<-\EOF &&
256
+ test_prepare_expect >expect <<-\EOF &&
257
master |
258
side |
259
odd/spot |
@@ -265,7 +271,7 @@ test_expect_success 'check `%(contents:lines=0)`' '
271
'
272
273
test_expect_success 'check `%(contents:lines=99999)`' '
268
- cat >expect <<-\EOF &&
274
+ test_prepare_expect >expect <<-\EOF &&
275
master |three
276
side |four
277
odd/spot |three