Skip to content

Commit 7ce0bee

Browse files
committed
Merge branch 'es/test-gpg-tags'
A test for tags has been restructured so that more parts of it can easily be run on a platform without a working GnuPG. * es/test-gpg-tags: t6302: skip only signed tags rather than all tests when GPG is missing t6302: also test annotated in addition to signed tags t6302: normalize names and descriptions of signed tags lib-gpg: drop unnecessary "missing GPG" warning
2 parents 087f171 + 618310a commit 7ce0bee

File tree

2 files changed

+65
-35
lines changed

2 files changed

+65
-35
lines changed

t/lib-gpg.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/sh
22

33
gpg_version=$(gpg --version 2>&1)
4-
if test $? = 127; then
5-
say "You do not seem to have gpg installed"
6-
else
4+
if test $? != 127
5+
then
76
# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
87
# the gpg version 1.0.6 didn't parse trust packets correctly, so for
98
# that version, creation of signed tags using the generated key fails.

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

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,28 @@ 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 &&
1619
test_commit two &&
1720
test_commit three &&
1821
git checkout -b side &&
1922
test_commit four &&
20-
git tag -s -m "A signed tag message" signed-tag &&
21-
git tag -s -m "Annonated doubly" double-tag signed-tag &&
23+
git tag -m "An annotated tag" annotated-tag &&
24+
git tag -m "Annonated doubly" doubly-annotated-tag annotated-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 &&
2230
git checkout master &&
2331
git update-ref refs/odd/spot master
2432
'
@@ -34,8 +42,9 @@ test_expect_success 'filtering with --points-at' '
3442
'
3543

3644
test_expect_success 'check signed tags with --points-at' '
37-
sed -e "s/Z$//" >expect <<-\EOF &&
45+
test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect &&
3846
refs/heads/side Z
47+
refs/tags/annotated-tag four
3948
refs/tags/four Z
4049
refs/tags/signed-tag four
4150
EOF
@@ -56,9 +65,11 @@ test_expect_success 'filtering with --merged' '
5665
'
5766

5867
test_expect_success 'filtering with --no-merged' '
59-
cat >expect <<-\EOF &&
68+
test_prepare_expect >expect <<-\EOF &&
6069
refs/heads/side
61-
refs/tags/double-tag
70+
refs/tags/annotated-tag
71+
refs/tags/doubly-annotated-tag
72+
refs/tags/doubly-signed-tag
6273
refs/tags/four
6374
refs/tags/signed-tag
6475
EOF
@@ -67,11 +78,13 @@ test_expect_success 'filtering with --no-merged' '
6778
'
6879

6980
test_expect_success 'filtering with --contains' '
70-
cat >expect <<-\EOF &&
81+
test_prepare_expect >expect <<-\EOF &&
7182
refs/heads/master
7283
refs/heads/side
7384
refs/odd/spot
74-
refs/tags/double-tag
85+
refs/tags/annotated-tag
86+
refs/tags/doubly-annotated-tag
87+
refs/tags/doubly-signed-tag
7588
refs/tags/four
7689
refs/tags/signed-tag
7790
refs/tags/three
@@ -86,11 +99,13 @@ test_expect_success '%(color) must fail' '
8699
'
87100

88101
test_expect_success 'left alignment is default' '
89-
cat >expect <<-\EOF &&
102+
test_prepare_expect >expect <<-\EOF &&
90103
refname is refs/heads/master |refs/heads/master
91104
refname is refs/heads/side |refs/heads/side
92105
refname is refs/odd/spot |refs/odd/spot
93-
refname is refs/tags/double-tag|refs/tags/double-tag
106+
refname is refs/tags/annotated-tag|refs/tags/annotated-tag
107+
refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
108+
refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
94109
refname is refs/tags/four |refs/tags/four
95110
refname is refs/tags/one |refs/tags/one
96111
refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -102,11 +117,13 @@ test_expect_success 'left alignment is default' '
102117
'
103118

104119
test_expect_success 'middle alignment' '
105-
cat >expect <<-\EOF &&
120+
test_prepare_expect >expect <<-\EOF &&
106121
| refname is refs/heads/master |refs/heads/master
107122
| refname is refs/heads/side |refs/heads/side
108123
| refname is refs/odd/spot |refs/odd/spot
109-
|refname is refs/tags/double-tag|refs/tags/double-tag
124+
|refname is refs/tags/annotated-tag|refs/tags/annotated-tag
125+
|refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
126+
|refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
110127
| refname is refs/tags/four |refs/tags/four
111128
| refname is refs/tags/one |refs/tags/one
112129
|refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -118,11 +135,13 @@ test_expect_success 'middle alignment' '
118135
'
119136

120137
test_expect_success 'right alignment' '
121-
cat >expect <<-\EOF &&
138+
test_prepare_expect >expect <<-\EOF &&
122139
| refname is refs/heads/master|refs/heads/master
123140
| refname is refs/heads/side|refs/heads/side
124141
| refname is refs/odd/spot|refs/odd/spot
125-
|refname is refs/tags/double-tag|refs/tags/double-tag
142+
|refname is refs/tags/annotated-tag|refs/tags/annotated-tag
143+
|refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
144+
|refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
126145
| refname is refs/tags/four|refs/tags/four
127146
| refname is refs/tags/one|refs/tags/one
128147
|refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -133,11 +152,13 @@ test_expect_success 'right alignment' '
133152
test_cmp expect actual
134153
'
135154

136-
cat >expect <<-\EOF
155+
test_prepare_expect >expect <<-\EOF
137156
| refname is refs/heads/master |refs/heads/master
138157
| refname is refs/heads/side |refs/heads/side
139158
| refname is refs/odd/spot |refs/odd/spot
140-
| refname is refs/tags/double-tag |refs/tags/double-tag
159+
| refname is refs/tags/annotated-tag |refs/tags/annotated-tag
160+
|refname is refs/tags/doubly-annotated-tag |refs/tags/doubly-annotated-tag
161+
| refname is refs/tags/doubly-signed-tag |refs/tags/doubly-signed-tag
141162
| refname is refs/tags/four |refs/tags/four
142163
| refname is refs/tags/one |refs/tags/one
143164
| refname is refs/tags/signed-tag |refs/tags/signed-tag
@@ -178,11 +199,13 @@ EOF
178199
# Individual atoms inside %(align:...) and %(end) must not be quoted.
179200

180201
test_expect_success 'alignment with format quote' "
181-
cat >expect <<-\EOF &&
202+
test_prepare_expect >expect <<-\EOF &&
182203
|' '\''master| A U Thor'\'' '|
183204
|' '\''side| A U Thor'\'' '|
184205
|' '\''odd/spot| A U Thor'\'' '|
185-
|' '\''double-tag| '\'' '|
206+
|' '\''annotated-tag| '\'' '|
207+
|' '\''doubly-annotated-tag| '\'' '|
208+
|' '\''doubly-signed-tag| '\'' '|
186209
|' '\''four| A U Thor'\'' '|
187210
|' '\''one| A U Thor'\'' '|
188211
|' '\''signed-tag| '\'' '|
@@ -194,11 +217,13 @@ test_expect_success 'alignment with format quote' "
194217
"
195218

196219
test_expect_success 'nested alignment with quote formatting' "
197-
cat >expect <<-\EOF &&
220+
test_prepare_expect >expect <<-\EOF &&
198221
|' master '|
199222
|' side '|
200223
|' odd/spot '|
201-
|' double-tag '|
224+
|' annotated-tag '|
225+
|'doubly-annotated-tag '|
226+
|'doubly-signed-tag '|
202227
|' four '|
203228
|' one '|
204229
|' signed-tag '|
@@ -210,14 +235,16 @@ test_expect_success 'nested alignment with quote formatting' "
210235
"
211236

212237
test_expect_success 'check `%(contents:lines=1)`' '
213-
cat >expect <<-\EOF &&
238+
test_prepare_expect >expect <<-\EOF &&
214239
master |three
215240
side |four
216241
odd/spot |three
217-
double-tag |Annonated doubly
242+
annotated-tag |An annotated tag
243+
doubly-annotated-tag |Annonated doubly
244+
doubly-signed-tag |Signed doubly
218245
four |four
219246
one |one
220-
signed-tag |A signed tag message
247+
signed-tag |A signed tag
221248
three |three
222249
two |two
223250
EOF
@@ -226,11 +253,13 @@ test_expect_success 'check `%(contents:lines=1)`' '
226253
'
227254

228255
test_expect_success 'check `%(contents:lines=0)`' '
229-
cat >expect <<-\EOF &&
256+
test_prepare_expect >expect <<-\EOF &&
230257
master |
231258
side |
232259
odd/spot |
233-
double-tag |
260+
annotated-tag |
261+
doubly-annotated-tag |
262+
doubly-signed-tag |
234263
four |
235264
one |
236265
signed-tag |
@@ -242,14 +271,16 @@ test_expect_success 'check `%(contents:lines=0)`' '
242271
'
243272

244273
test_expect_success 'check `%(contents:lines=99999)`' '
245-
cat >expect <<-\EOF &&
274+
test_prepare_expect >expect <<-\EOF &&
246275
master |three
247276
side |four
248277
odd/spot |three
249-
double-tag |Annonated doubly
278+
annotated-tag |An annotated tag
279+
doubly-annotated-tag |Annonated doubly
280+
doubly-signed-tag |Signed doubly
250281
four |four
251282
one |one
252-
signed-tag |A signed tag message
283+
signed-tag |A signed tag
253284
three |three
254285
two |two
255286
EOF

0 commit comments

Comments
 (0)