5
. ./test-lib.sh
6
. "$TEST_DIRECTORY"/lib-gpg.sh
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
-
8
test_expect_success 'setup some history and refs' '
9
test_commit one &&
10
test_commit two &&
13
test_commit four &&
14
git tag -m "An annotated tag" annotated-tag &&
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.
20
if test_have_prereq GPG
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=
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
+
29
git checkout master &&
30
git update-ref refs/odd/spot master
31
'
41
'
42
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 &&
45
refs/heads/side Z
46
refs/tags/annotated-tag four
47
refs/tags/four Z
64
'
65
66
test_expect_success 'filtering with --no-merged' '
68
- test_prepare_expect >expect <<-\EOF &&
67
+ cat >expect <<-\EOF &&
68
refs/heads/side
69
refs/tags/annotated-tag
70
refs/tags/doubly-annotated-tag
77
'
78
79
test_expect_success 'filtering with --contains' '
81
- test_prepare_expect >expect <<-\EOF &&
80
+ cat >expect <<-\EOF &&
81
refs/heads/master
82
refs/heads/side
83
refs/odd/spot
98
'
99
100
test_expect_success 'left alignment is default' '
102
- test_prepare_expect >expect <<-\EOF &&
101
+ cat >expect <<-\EOF &&
102
refname is refs/heads/master |refs/heads/master
103
refname is refs/heads/side |refs/heads/side
104
refname is refs/odd/spot |refs/odd/spot
116
'
117
118
test_expect_success 'middle alignment' '
120
- test_prepare_expect >expect <<-\EOF &&
119
+ cat >expect <<-\EOF &&
120
| refname is refs/heads/master |refs/heads/master
121
| refname is refs/heads/side |refs/heads/side
122
| refname is refs/odd/spot |refs/odd/spot
134
'
135
136
test_expect_success 'right alignment' '
138
- test_prepare_expect >expect <<-\EOF &&
137
+ cat >expect <<-\EOF &&
138
| refname is refs/heads/master|refs/heads/master
139
| refname is refs/heads/side|refs/heads/side
140
| refname is refs/odd/spot|refs/odd/spot
151
test_cmp expect actual
152
'
153
155
-test_prepare_expect >expect <<-\EOF
154
+cat >expect <<-\EOF
155
| refname is refs/heads/master |refs/heads/master
156
| refname is refs/heads/side |refs/heads/side
157
| refname is refs/odd/spot |refs/odd/spot
198
# Individual atoms inside %(align:...) and %(end) must not be quoted.
199
200
test_expect_success 'alignment with format quote' "
202
- test_prepare_expect >expect <<-\EOF &&
201
+ cat >expect <<-\EOF &&
202
|' '\''master| A U Thor'\'' '|
203
|' '\''side| A U Thor'\'' '|
204
|' '\''odd/spot| A U Thor'\'' '|
216
"
217
218
test_expect_success 'nested alignment with quote formatting' "
220
- test_prepare_expect >expect <<-\EOF &&
219
+ cat >expect <<-\EOF &&
220
|' master '|
221
|' side '|
222
|' odd/spot '|
234
"
235
236
test_expect_success 'check `%(contents:lines=1)`' '
238
- test_prepare_expect >expect <<-\EOF &&
237
+ cat >expect <<-\EOF &&
238
master |three
239
side |four
240
odd/spot |three
252
'
253
254
test_expect_success 'check `%(contents:lines=0)`' '
256
- test_prepare_expect >expect <<-\EOF &&
255
+ cat >expect <<-\EOF &&
256
master |
257
side |
258
odd/spot |
270
'
271
272
test_expect_success 'check `%(contents:lines=99999)`' '
274
- test_prepare_expect >expect <<-\EOF &&
273
+ cat >expect <<-\EOF &&
274
master |three
275
side |four
276
odd/spot |three