Skip to content

Commit 36d2b9a

Browse files
committed
Merge branch 'es/test-gpg-tags'
Test fix. * es/test-gpg-tags: t6302: simplify non-gpg cases
2 parents d130bf4 + f307218 commit 36d2b9a

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

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

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

8-
test_prepare_expect () {
9-
if test_have_prereq GPG
10-
then
11-
cat
12-
else
13-
sed '/signed/d'
14-
fi
15-
}
16-
178
test_expect_success 'setup some history and refs' '
189
test_commit one &&
1910
test_commit two &&
@@ -22,11 +13,19 @@ test_expect_success 'setup some history and refs' '
2213
test_commit four &&
2314
git tag -m "An annotated tag" annotated-tag &&
2415
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.
2520
if test_have_prereq GPG
2621
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=
2925
fi &&
26+
git tag $sign -m "A signed tag" signed-tag &&
27+
git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag &&
28+
3029
git checkout master &&
3130
git update-ref refs/odd/spot master
3231
'
@@ -42,7 +41,7 @@ test_expect_success 'filtering with --points-at' '
4241
'
4342

4443
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 &&
4645
refs/heads/side Z
4746
refs/tags/annotated-tag four
4847
refs/tags/four Z
@@ -65,7 +64,7 @@ test_expect_success 'filtering with --merged' '
6564
'
6665

6766
test_expect_success 'filtering with --no-merged' '
68-
test_prepare_expect >expect <<-\EOF &&
67+
cat >expect <<-\EOF &&
6968
refs/heads/side
7069
refs/tags/annotated-tag
7170
refs/tags/doubly-annotated-tag
@@ -78,7 +77,7 @@ test_expect_success 'filtering with --no-merged' '
7877
'
7978

8079
test_expect_success 'filtering with --contains' '
81-
test_prepare_expect >expect <<-\EOF &&
80+
cat >expect <<-\EOF &&
8281
refs/heads/master
8382
refs/heads/side
8483
refs/odd/spot
@@ -99,7 +98,7 @@ test_expect_success '%(color) must fail' '
9998
'
10099

101100
test_expect_success 'left alignment is default' '
102-
test_prepare_expect >expect <<-\EOF &&
101+
cat >expect <<-\EOF &&
103102
refname is refs/heads/master |refs/heads/master
104103
refname is refs/heads/side |refs/heads/side
105104
refname is refs/odd/spot |refs/odd/spot
@@ -117,7 +116,7 @@ test_expect_success 'left alignment is default' '
117116
'
118117

119118
test_expect_success 'middle alignment' '
120-
test_prepare_expect >expect <<-\EOF &&
119+
cat >expect <<-\EOF &&
121120
| refname is refs/heads/master |refs/heads/master
122121
| refname is refs/heads/side |refs/heads/side
123122
| refname is refs/odd/spot |refs/odd/spot
@@ -135,7 +134,7 @@ test_expect_success 'middle alignment' '
135134
'
136135

137136
test_expect_success 'right alignment' '
138-
test_prepare_expect >expect <<-\EOF &&
137+
cat >expect <<-\EOF &&
139138
| refname is refs/heads/master|refs/heads/master
140139
| refname is refs/heads/side|refs/heads/side
141140
| refname is refs/odd/spot|refs/odd/spot
@@ -152,7 +151,7 @@ test_expect_success 'right alignment' '
152151
test_cmp expect actual
153152
'
154153

155-
test_prepare_expect >expect <<-\EOF
154+
cat >expect <<-\EOF
156155
| refname is refs/heads/master |refs/heads/master
157156
| refname is refs/heads/side |refs/heads/side
158157
| refname is refs/odd/spot |refs/odd/spot
@@ -199,7 +198,7 @@ EOF
199198
# Individual atoms inside %(align:...) and %(end) must not be quoted.
200199

201200
test_expect_success 'alignment with format quote' "
202-
test_prepare_expect >expect <<-\EOF &&
201+
cat >expect <<-\EOF &&
203202
|' '\''master| A U Thor'\'' '|
204203
|' '\''side| A U Thor'\'' '|
205204
|' '\''odd/spot| A U Thor'\'' '|
@@ -217,7 +216,7 @@ test_expect_success 'alignment with format quote' "
217216
"
218217

219218
test_expect_success 'nested alignment with quote formatting' "
220-
test_prepare_expect >expect <<-\EOF &&
219+
cat >expect <<-\EOF &&
221220
|' master '|
222221
|' side '|
223222
|' odd/spot '|
@@ -235,7 +234,7 @@ test_expect_success 'nested alignment with quote formatting' "
235234
"
236235

237236
test_expect_success 'check `%(contents:lines=1)`' '
238-
test_prepare_expect >expect <<-\EOF &&
237+
cat >expect <<-\EOF &&
239238
master |three
240239
side |four
241240
odd/spot |three
@@ -253,7 +252,7 @@ test_expect_success 'check `%(contents:lines=1)`' '
253252
'
254253

255254
test_expect_success 'check `%(contents:lines=0)`' '
256-
test_prepare_expect >expect <<-\EOF &&
255+
cat >expect <<-\EOF &&
257256
master |
258257
side |
259258
odd/spot |
@@ -271,7 +270,7 @@ test_expect_success 'check `%(contents:lines=0)`' '
271270
'
272271

273272
test_expect_success 'check `%(contents:lines=99999)`' '
274-
test_prepare_expect >expect <<-\EOF &&
273+
cat >expect <<-\EOF &&
275274
master |three
276275
side |four
277276
odd/spot |three

0 commit comments

Comments
 (0)