@@ -5,11 +5,14 @@ test_description='test for-each-refs usage of ref-filter APIs'
5
5
. ./test-lib.sh
6
6
. " $TEST_DIRECTORY " /lib-gpg.sh
7
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
+ }
13
16
14
17
test_expect_success ' setup some history and refs' '
15
18
test_commit one &&
@@ -19,8 +22,11 @@ test_expect_success 'setup some history and refs' '
19
22
test_commit four &&
20
23
git tag -m "An annotated tag" annotated-tag &&
21
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 &&
24
30
git checkout master &&
25
31
git update-ref refs/odd/spot master
26
32
'
@@ -36,7 +42,7 @@ test_expect_success 'filtering with --points-at' '
36
42
'
37
43
38
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 &&
40
46
refs/heads/side Z
41
47
refs/tags/annotated-tag four
42
48
refs/tags/four Z
@@ -59,7 +65,7 @@ test_expect_success 'filtering with --merged' '
59
65
'
60
66
61
67
test_expect_success ' filtering with --no-merged' '
62
- cat >expect <<-\EOF &&
68
+ test_prepare_expect >expect <<-\EOF &&
63
69
refs/heads/side
64
70
refs/tags/annotated-tag
65
71
refs/tags/doubly-annotated-tag
@@ -72,7 +78,7 @@ test_expect_success 'filtering with --no-merged' '
72
78
'
73
79
74
80
test_expect_success ' filtering with --contains' '
75
- cat >expect <<-\EOF &&
81
+ test_prepare_expect >expect <<-\EOF &&
76
82
refs/heads/master
77
83
refs/heads/side
78
84
refs/odd/spot
@@ -93,7 +99,7 @@ test_expect_success '%(color) must fail' '
93
99
'
94
100
95
101
test_expect_success ' left alignment is default' '
96
- cat >expect <<-\EOF &&
102
+ test_prepare_expect >expect <<-\EOF &&
97
103
refname is refs/heads/master |refs/heads/master
98
104
refname is refs/heads/side |refs/heads/side
99
105
refname is refs/odd/spot |refs/odd/spot
@@ -111,7 +117,7 @@ test_expect_success 'left alignment is default' '
111
117
'
112
118
113
119
test_expect_success ' middle alignment' '
114
- cat >expect <<-\EOF &&
120
+ test_prepare_expect >expect <<-\EOF &&
115
121
| refname is refs/heads/master |refs/heads/master
116
122
| refname is refs/heads/side |refs/heads/side
117
123
| refname is refs/odd/spot |refs/odd/spot
@@ -129,7 +135,7 @@ test_expect_success 'middle alignment' '
129
135
'
130
136
131
137
test_expect_success ' right alignment' '
132
- cat >expect <<-\EOF &&
138
+ test_prepare_expect >expect <<-\EOF &&
133
139
| refname is refs/heads/master|refs/heads/master
134
140
| refname is refs/heads/side|refs/heads/side
135
141
| refname is refs/odd/spot|refs/odd/spot
@@ -146,7 +152,7 @@ test_expect_success 'right alignment' '
146
152
test_cmp expect actual
147
153
'
148
154
149
- cat > expect << -\EOF
155
+ test_prepare_expect > expect << -\EOF
150
156
| refname is refs/heads/master |refs/heads/master
151
157
| refname is refs/heads/side |refs/heads/side
152
158
| refname is refs/odd/spot |refs/odd/spot
193
199
# Individual atoms inside %(align:...) and %(end) must not be quoted.
194
200
195
201
test_expect_success ' alignment with format quote' "
196
- cat >expect <<-\EOF &&
202
+ test_prepare_expect >expect <<-\EOF &&
197
203
|' '\''master| A U Thor'\'' '|
198
204
|' '\''side| A U Thor'\'' '|
199
205
|' '\''odd/spot| A U Thor'\'' '|
@@ -211,7 +217,7 @@ test_expect_success 'alignment with format quote' "
211
217
"
212
218
213
219
test_expect_success ' nested alignment with quote formatting' "
214
- cat >expect <<-\EOF &&
220
+ test_prepare_expect >expect <<-\EOF &&
215
221
|' master '|
216
222
|' side '|
217
223
|' odd/spot '|
@@ -229,7 +235,7 @@ test_expect_success 'nested alignment with quote formatting' "
229
235
"
230
236
231
237
test_expect_success ' check `%(contents:lines=1)`' '
232
- cat >expect <<-\EOF &&
238
+ test_prepare_expect >expect <<-\EOF &&
233
239
master |three
234
240
side |four
235
241
odd/spot |three
@@ -247,7 +253,7 @@ test_expect_success 'check `%(contents:lines=1)`' '
247
253
'
248
254
249
255
test_expect_success ' check `%(contents:lines=0)`' '
250
- cat >expect <<-\EOF &&
256
+ test_prepare_expect >expect <<-\EOF &&
251
257
master |
252
258
side |
253
259
odd/spot |
@@ -265,7 +271,7 @@ test_expect_success 'check `%(contents:lines=0)`' '
265
271
'
266
272
267
273
test_expect_success ' check `%(contents:lines=99999)`' '
268
- cat >expect <<-\EOF &&
274
+ test_prepare_expect >expect <<-\EOF &&
269
275
master |three
270
276
side |four
271
277
odd/spot |three
0 commit comments