@@ -5,15 +5,6 @@ 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
- test_prepare_expect () {
9
- if test_have_prereq GPG
10
- then
11
- cat
12
- else
13
- sed ' /signed/d'
14
- fi
15
- }
16
-
17
8
test_expect_success ' setup some history and refs' '
18
9
test_commit one &&
19
10
test_commit two &&
@@ -22,11 +13,19 @@ test_expect_success 'setup some history and refs' '
22
13
test_commit four &&
23
14
git tag -m "An annotated tag" annotated-tag &&
24
15
git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag &&
16
+
17
+ # Note that these "signed" tags might not actually be signed.
18
+ # Tests which care about the distinction should be marked
19
+ # with the GPG prereq.
25
20
if test_have_prereq GPG
26
21
then
27
- git tag -s -m "A signed tag" signed-tag &&
28
- git tag -s -m "Signed doubly" doubly-signed-tag signed-tag
22
+ sign=-s
23
+ else
24
+ sign=
29
25
fi &&
26
+ git tag $sign -m "A signed tag" signed-tag &&
27
+ git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag &&
28
+
30
29
git checkout master &&
31
30
git update-ref refs/odd/spot master
32
31
'
@@ -42,7 +41,7 @@ test_expect_success 'filtering with --points-at' '
42
41
'
43
42
44
43
test_expect_success ' check signed tags with --points-at' '
45
- test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect &&
44
+ sed -e "s/Z$//" >expect <<-\EOF &&
46
45
refs/heads/side Z
47
46
refs/tags/annotated-tag four
48
47
refs/tags/four Z
@@ -65,7 +64,7 @@ test_expect_success 'filtering with --merged' '
65
64
'
66
65
67
66
test_expect_success ' filtering with --no-merged' '
68
- test_prepare_expect >expect <<-\EOF &&
67
+ cat >expect <<-\EOF &&
69
68
refs/heads/side
70
69
refs/tags/annotated-tag
71
70
refs/tags/doubly-annotated-tag
@@ -78,7 +77,7 @@ test_expect_success 'filtering with --no-merged' '
78
77
'
79
78
80
79
test_expect_success ' filtering with --contains' '
81
- test_prepare_expect >expect <<-\EOF &&
80
+ cat >expect <<-\EOF &&
82
81
refs/heads/master
83
82
refs/heads/side
84
83
refs/odd/spot
@@ -99,7 +98,7 @@ test_expect_success '%(color) must fail' '
99
98
'
100
99
101
100
test_expect_success ' left alignment is default' '
102
- test_prepare_expect >expect <<-\EOF &&
101
+ cat >expect <<-\EOF &&
103
102
refname is refs/heads/master |refs/heads/master
104
103
refname is refs/heads/side |refs/heads/side
105
104
refname is refs/odd/spot |refs/odd/spot
@@ -117,7 +116,7 @@ test_expect_success 'left alignment is default' '
117
116
'
118
117
119
118
test_expect_success ' middle alignment' '
120
- test_prepare_expect >expect <<-\EOF &&
119
+ cat >expect <<-\EOF &&
121
120
| refname is refs/heads/master |refs/heads/master
122
121
| refname is refs/heads/side |refs/heads/side
123
122
| refname is refs/odd/spot |refs/odd/spot
@@ -135,7 +134,7 @@ test_expect_success 'middle alignment' '
135
134
'
136
135
137
136
test_expect_success ' right alignment' '
138
- test_prepare_expect >expect <<-\EOF &&
137
+ cat >expect <<-\EOF &&
139
138
| refname is refs/heads/master|refs/heads/master
140
139
| refname is refs/heads/side|refs/heads/side
141
140
| refname is refs/odd/spot|refs/odd/spot
@@ -152,7 +151,7 @@ test_expect_success 'right alignment' '
152
151
test_cmp expect actual
153
152
'
154
153
155
- test_prepare_expect > expect << -\EOF
154
+ cat > expect << -\EOF
156
155
| refname is refs/heads/master |refs/heads/master
157
156
| refname is refs/heads/side |refs/heads/side
158
157
| refname is refs/odd/spot |refs/odd/spot
199
198
# Individual atoms inside %(align:...) and %(end) must not be quoted.
200
199
201
200
test_expect_success ' alignment with format quote' "
202
- test_prepare_expect >expect <<-\EOF &&
201
+ cat >expect <<-\EOF &&
203
202
|' '\''master| A U Thor'\'' '|
204
203
|' '\''side| A U Thor'\'' '|
205
204
|' '\''odd/spot| A U Thor'\'' '|
@@ -217,7 +216,7 @@ test_expect_success 'alignment with format quote' "
217
216
"
218
217
219
218
test_expect_success ' nested alignment with quote formatting' "
220
- test_prepare_expect >expect <<-\EOF &&
219
+ cat >expect <<-\EOF &&
221
220
|' master '|
222
221
|' side '|
223
222
|' odd/spot '|
@@ -235,7 +234,7 @@ test_expect_success 'nested alignment with quote formatting' "
235
234
"
236
235
237
236
test_expect_success ' check `%(contents:lines=1)`' '
238
- test_prepare_expect >expect <<-\EOF &&
237
+ cat >expect <<-\EOF &&
239
238
master |three
240
239
side |four
241
240
odd/spot |three
@@ -253,7 +252,7 @@ test_expect_success 'check `%(contents:lines=1)`' '
253
252
'
254
253
255
254
test_expect_success ' check `%(contents:lines=0)`' '
256
- test_prepare_expect >expect <<-\EOF &&
255
+ cat >expect <<-\EOF &&
257
256
master |
258
257
side |
259
258
odd/spot |
@@ -271,7 +270,7 @@ test_expect_success 'check `%(contents:lines=0)`' '
271
270
'
272
271
273
272
test_expect_success ' check `%(contents:lines=99999)`' '
274
- test_prepare_expect >expect <<-\EOF &&
273
+ cat >expect <<-\EOF &&
275
274
master |three
276
275
side |four
277
276
odd/spot |three
0 commit comments