]>
Commit | Line | Data |
---|---|---|
ef5a6fb5 CR |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Carlos Rica | |
4 | # | |
5 | ||
d592b315 | 6 | test_description='git tag |
ef5a6fb5 | 7 | |
62e09ce9 | 8 | Tests for operations with tags.' |
ef5a6fb5 CR |
9 | |
10 | . ./test-lib.sh | |
37d3e859 | 11 | . "$TEST_DIRECTORY"/lib-gpg.sh |
ef5a6fb5 CR |
12 | |
13 | # creating and listing lightweight tags: | |
14 | ||
15 | tag_exists () { | |
16 | git show-ref --quiet --verify refs/tags/"$1" | |
17 | } | |
18 | ||
19 | # todo: git tag -l now returns always zero, when fixed, change this test | |
62e09ce9 CR |
20 | test_expect_success 'listing all tags in an empty tree should succeed' ' |
21 | git tag -l && | |
22 | git tag | |
23 | ' | |
ef5a6fb5 | 24 | |
62e09ce9 | 25 | test_expect_success 'listing all tags in an empty tree should output nothing' ' |
d592b315 NS |
26 | test `git tag -l | wc -l` -eq 0 && |
27 | test `git tag | wc -l` -eq 0 | |
62e09ce9 | 28 | ' |
ef5a6fb5 | 29 | |
41ac414e JH |
30 | test_expect_success 'looking for a tag in an empty tree should fail' \ |
31 | '! (tag_exists mytag)' | |
ef5a6fb5 CR |
32 | |
33 | test_expect_success 'creating a tag in an empty tree should fail' ' | |
d592b315 | 34 | test_must_fail git tag mynotag && |
ef5a6fb5 CR |
35 | ! tag_exists mynotag |
36 | ' | |
37 | ||
38 | test_expect_success 'creating a tag for HEAD in an empty tree should fail' ' | |
d592b315 | 39 | test_must_fail git tag mytaghead HEAD && |
ef5a6fb5 CR |
40 | ! tag_exists mytaghead |
41 | ' | |
42 | ||
43 | test_expect_success 'creating a tag for an unknown revision should fail' ' | |
d592b315 | 44 | test_must_fail git tag mytagnorev aaaaaaaaaaa && |
ef5a6fb5 CR |
45 | ! tag_exists mytagnorev |
46 | ' | |
47 | ||
48 | # commit used in the tests, test_tick is also called here to freeze the date: | |
49 | test_expect_success 'creating a tag using default HEAD should succeed' ' | |
50 | test_tick && | |
51 | echo foo >foo && | |
52 | git add foo && | |
53 | git commit -m Foo && | |
54 | git tag mytag | |
55 | ' | |
56 | ||
62e09ce9 | 57 | test_expect_success 'listing all tags if one exists should succeed' ' |
d592b315 NS |
58 | git tag -l && |
59 | git tag | |
62e09ce9 | 60 | ' |
ef5a6fb5 | 61 | |
62e09ce9 | 62 | test_expect_success 'listing all tags if one exists should output that tag' ' |
d592b315 NS |
63 | test `git tag -l` = mytag && |
64 | test `git tag` = mytag | |
62e09ce9 | 65 | ' |
ef5a6fb5 CR |
66 | |
67 | # pattern matching: | |
68 | ||
69 | test_expect_success 'listing a tag using a matching pattern should succeed' \ | |
d592b315 | 70 | 'git tag -l mytag' |
ef5a6fb5 CR |
71 | |
72 | test_expect_success \ | |
73 | 'listing a tag using a matching pattern should output that tag' \ | |
d592b315 | 74 | 'test `git tag -l mytag` = mytag' |
ef5a6fb5 CR |
75 | |
76 | # todo: git tag -l now returns always zero, when fixed, change this test | |
77 | test_expect_success \ | |
78 | 'listing tags using a non-matching pattern should suceed' \ | |
d592b315 | 79 | 'git tag -l xxx' |
ef5a6fb5 CR |
80 | |
81 | test_expect_success \ | |
82 | 'listing tags using a non-matching pattern should output nothing' \ | |
d592b315 | 83 | 'test `git tag -l xxx | wc -l` -eq 0' |
ef5a6fb5 CR |
84 | |
85 | # special cases for creating tags: | |
86 | ||
41ac414e | 87 | test_expect_success \ |
ef5a6fb5 | 88 | 'trying to create a tag with the name of one existing should fail' \ |
d492b31c | 89 | 'test_must_fail git tag mytag' |
ef5a6fb5 CR |
90 | |
91 | test_expect_success \ | |
92 | 'trying to create a tag with a non-valid name should fail' ' | |
d592b315 | 93 | test `git tag -l | wc -l` -eq 1 && |
d492b31c SB |
94 | test_must_fail git tag "" && |
95 | test_must_fail git tag .othertag && | |
96 | test_must_fail git tag "other tag" && | |
97 | test_must_fail git tag "othertag^" && | |
98 | test_must_fail git tag "other~tag" && | |
d592b315 | 99 | test `git tag -l | wc -l` -eq 1 |
ef5a6fb5 CR |
100 | ' |
101 | ||
102 | test_expect_success 'creating a tag using HEAD directly should succeed' ' | |
103 | git tag myhead HEAD && | |
104 | tag_exists myhead | |
105 | ' | |
106 | ||
3ae851e6 PH |
107 | test_expect_success '--force can create a tag with the name of one existing' ' |
108 | tag_exists mytag && | |
109 | git tag --force mytag && | |
110 | tag_exists mytag' | |
111 | ||
112 | test_expect_success '--force is moot with a non-existing tag name' ' | |
113 | git tag newtag >expect && | |
114 | git tag --force forcetag >actual && | |
115 | test_cmp expect actual | |
116 | ' | |
117 | git tag -d newtag forcetag | |
118 | ||
ef5a6fb5 CR |
119 | # deleting tags: |
120 | ||
121 | test_expect_success 'trying to delete an unknown tag should fail' ' | |
122 | ! tag_exists unknown-tag && | |
d592b315 | 123 | test_must_fail git tag -d unknown-tag |
ef5a6fb5 CR |
124 | ' |
125 | ||
126 | cat >expect <<EOF | |
127 | myhead | |
128 | mytag | |
129 | EOF | |
130 | test_expect_success \ | |
131 | 'trying to delete tags without params should succeed and do nothing' ' | |
3af82863 | 132 | git tag -l > actual && test_cmp expect actual && |
d592b315 | 133 | git tag -d && |
3af82863 | 134 | git tag -l > actual && test_cmp expect actual |
ef5a6fb5 CR |
135 | ' |
136 | ||
137 | test_expect_success \ | |
138 | 'deleting two existing tags in one command should succeed' ' | |
139 | tag_exists mytag && | |
140 | tag_exists myhead && | |
d592b315 | 141 | git tag -d mytag myhead && |
ef5a6fb5 CR |
142 | ! tag_exists mytag && |
143 | ! tag_exists myhead | |
144 | ' | |
145 | ||
146 | test_expect_success \ | |
147 | 'creating a tag with the name of another deleted one should succeed' ' | |
148 | ! tag_exists mytag && | |
d592b315 | 149 | git tag mytag && |
ef5a6fb5 CR |
150 | tag_exists mytag |
151 | ' | |
152 | ||
153 | test_expect_success \ | |
154 | 'trying to delete two tags, existing and not, should fail in the 2nd' ' | |
155 | tag_exists mytag && | |
156 | ! tag_exists myhead && | |
d592b315 | 157 | test_must_fail git tag -d mytag anothertag && |
ef5a6fb5 CR |
158 | ! tag_exists mytag && |
159 | ! tag_exists myhead | |
160 | ' | |
161 | ||
41ac414e | 162 | test_expect_success 'trying to delete an already deleted tag should fail' \ |
d592b315 | 163 | 'test_must_fail git tag -d mytag' |
ef5a6fb5 CR |
164 | |
165 | # listing various tags with pattern matching: | |
166 | ||
167 | cat >expect <<EOF | |
168 | a1 | |
169 | aa1 | |
170 | cba | |
171 | t210 | |
172 | t211 | |
173 | v0.2.1 | |
174 | v1.0 | |
175 | v1.0.1 | |
176 | v1.1.3 | |
177 | EOF | |
178 | test_expect_success 'listing all tags should print them ordered' ' | |
179 | git tag v1.0.1 && | |
180 | git tag t211 && | |
181 | git tag aa1 && | |
182 | git tag v0.2.1 && | |
183 | git tag v1.1.3 && | |
184 | git tag cba && | |
185 | git tag a1 && | |
186 | git tag v1.0 && | |
187 | git tag t210 && | |
5206d130 | 188 | git tag -l > actual && |
3af82863 | 189 | test_cmp expect actual && |
62e09ce9 | 190 | git tag > actual && |
3af82863 | 191 | test_cmp expect actual |
ef5a6fb5 CR |
192 | ' |
193 | ||
194 | cat >expect <<EOF | |
195 | a1 | |
196 | aa1 | |
197 | cba | |
198 | EOF | |
199 | test_expect_success \ | |
200 | 'listing tags with substring as pattern must print those matching' ' | |
0aaaef7b JS |
201 | rm *a* && |
202 | git tag -l "*a*" > current && | |
203 | test_cmp expect current | |
ef5a6fb5 CR |
204 | ' |
205 | ||
206 | cat >expect <<EOF | |
207 | v0.2.1 | |
208 | v1.0.1 | |
ef5a6fb5 CR |
209 | EOF |
210 | test_expect_success \ | |
18e32b5b | 211 | 'listing tags with a suffix as pattern must print those matching' ' |
d592b315 | 212 | git tag -l "*.1" > actual && |
3af82863 | 213 | test_cmp expect actual |
ef5a6fb5 CR |
214 | ' |
215 | ||
216 | cat >expect <<EOF | |
217 | t210 | |
218 | t211 | |
219 | EOF | |
220 | test_expect_success \ | |
18e32b5b | 221 | 'listing tags with a prefix as pattern must print those matching' ' |
d592b315 | 222 | git tag -l "t21*" > actual && |
3af82863 | 223 | test_cmp expect actual |
ef5a6fb5 CR |
224 | ' |
225 | ||
226 | cat >expect <<EOF | |
227 | a1 | |
ef5a6fb5 CR |
228 | EOF |
229 | test_expect_success \ | |
18e32b5b | 230 | 'listing tags using a name as pattern must print that one matching' ' |
d592b315 | 231 | git tag -l a1 > actual && |
3af82863 | 232 | test_cmp expect actual |
ef5a6fb5 CR |
233 | ' |
234 | ||
235 | cat >expect <<EOF | |
236 | v1.0 | |
ef5a6fb5 CR |
237 | EOF |
238 | test_expect_success \ | |
18e32b5b | 239 | 'listing tags using a name as pattern must print that one matching' ' |
d592b315 | 240 | git tag -l v1.0 > actual && |
3af82863 | 241 | test_cmp expect actual |
ef5a6fb5 CR |
242 | ' |
243 | ||
244 | cat >expect <<EOF | |
18e32b5b | 245 | v1.0.1 |
ef5a6fb5 CR |
246 | v1.1.3 |
247 | EOF | |
248 | test_expect_success \ | |
249 | 'listing tags with ? in the pattern should print those matching' ' | |
d592b315 | 250 | git tag -l "v1.?.?" > actual && |
3af82863 | 251 | test_cmp expect actual |
ef5a6fb5 CR |
252 | ' |
253 | ||
254 | >expect | |
255 | test_expect_success \ | |
256 | 'listing tags using v.* should print nothing because none have v.' ' | |
d592b315 | 257 | git tag -l "v.*" > actual && |
3af82863 | 258 | test_cmp expect actual |
ef5a6fb5 CR |
259 | ' |
260 | ||
261 | cat >expect <<EOF | |
262 | v0.2.1 | |
263 | v1.0 | |
264 | v1.0.1 | |
265 | v1.1.3 | |
266 | EOF | |
267 | test_expect_success \ | |
268 | 'listing tags using v* should print only those having v' ' | |
d592b315 | 269 | git tag -l "v*" > actual && |
3af82863 | 270 | test_cmp expect actual |
ef5a6fb5 CR |
271 | ' |
272 | ||
588d0e83 JK |
273 | test_expect_success 'tag -l can accept multiple patterns' ' |
274 | git tag -l "v1*" "v0*" >actual && | |
275 | test_cmp expect actual | |
276 | ' | |
277 | ||
d96e3c15 NTND |
278 | test_expect_success 'listing tags in column' ' |
279 | COLUMNS=40 git tag -l --column=row >actual && | |
280 | cat >expected <<\EOF && | |
281 | a1 aa1 cba t210 t211 | |
282 | v0.2.1 v1.0 v1.0.1 v1.1.3 | |
283 | EOF | |
284 | test_cmp expected actual | |
285 | ' | |
286 | ||
287 | test_expect_success 'listing tags in column with column.*' ' | |
288 | git config column.tag row && | |
289 | git config column.ui dense && | |
290 | COLUMNS=40 git tag -l >actual && | |
291 | git config --unset column.ui && | |
292 | git config --unset column.tag && | |
293 | cat >expected <<\EOF && | |
294 | a1 aa1 cba t210 t211 | |
295 | v0.2.1 v1.0 v1.0.1 v1.1.3 | |
296 | EOF | |
297 | test_cmp expected actual | |
298 | ' | |
299 | ||
300 | test_expect_success 'listing tag with -n --column should fail' ' | |
301 | test_must_fail git tag --column -n | |
302 | ' | |
303 | ||
304 | test_expect_success 'listing tags -n in column with column.ui ignored' ' | |
305 | git config column.ui "row dense" && | |
306 | COLUMNS=40 git tag -l -n >actual && | |
307 | git config --unset column.ui && | |
308 | cat >expected <<\EOF && | |
309 | a1 Foo | |
310 | aa1 Foo | |
311 | cba Foo | |
312 | t210 Foo | |
313 | t211 Foo | |
314 | v0.2.1 Foo | |
315 | v1.0 Foo | |
316 | v1.0.1 Foo | |
317 | v1.1.3 Foo | |
318 | EOF | |
319 | test_cmp expected actual | |
320 | ' | |
321 | ||
ef5a6fb5 CR |
322 | # creating and verifying lightweight tags: |
323 | ||
324 | test_expect_success \ | |
325 | 'a non-annotated tag created without parameters should point to HEAD' ' | |
d592b315 | 326 | git tag non-annotated-tag && |
5be60078 JH |
327 | test $(git cat-file -t non-annotated-tag) = commit && |
328 | test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD) | |
ef5a6fb5 CR |
329 | ' |
330 | ||
41ac414e | 331 | test_expect_success 'trying to verify an unknown tag should fail' \ |
d592b315 | 332 | 'test_must_fail git tag -v unknown-tag' |
ef5a6fb5 | 333 | |
41ac414e | 334 | test_expect_success \ |
ef5a6fb5 | 335 | 'trying to verify a non-annotated and non-signed tag should fail' \ |
d592b315 | 336 | 'test_must_fail git tag -v non-annotated-tag' |
ef5a6fb5 | 337 | |
41ac414e | 338 | test_expect_success \ |
62e09ce9 | 339 | 'trying to verify many non-annotated or unknown tags, should fail' \ |
d592b315 | 340 | 'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2' |
62e09ce9 | 341 | |
ef5a6fb5 CR |
342 | # creating annotated tags: |
343 | ||
344 | get_tag_msg () { | |
345 | git cat-file tag "$1" | sed -e "/BEGIN PGP/q" | |
346 | } | |
347 | ||
348 | # run test_tick before committing always gives the time in that timezone | |
349 | get_tag_header () { | |
350 | cat <<EOF | |
351 | object $2 | |
352 | type $3 | |
353 | tag $1 | |
354 | tagger C O Mitter <committer@example.com> $4 -0700 | |
355 | ||
356 | EOF | |
357 | } | |
358 | ||
359 | commit=$(git rev-parse HEAD) | |
360 | time=$test_tick | |
361 | ||
362 | get_tag_header annotated-tag $commit commit $time >expect | |
363 | echo "A message" >>expect | |
364 | test_expect_success \ | |
365 | 'creating an annotated tag with -m message should succeed' ' | |
d592b315 | 366 | git tag -m "A message" annotated-tag && |
ef5a6fb5 | 367 | get_tag_msg annotated-tag >actual && |
3af82863 | 368 | test_cmp expect actual |
ef5a6fb5 CR |
369 | ' |
370 | ||
371 | cat >msgfile <<EOF | |
372 | Another message | |
373 | in a file. | |
374 | EOF | |
375 | get_tag_header file-annotated-tag $commit commit $time >expect | |
376 | cat msgfile >>expect | |
377 | test_expect_success \ | |
378 | 'creating an annotated tag with -F messagefile should succeed' ' | |
d592b315 | 379 | git tag -F msgfile file-annotated-tag && |
ef5a6fb5 | 380 | get_tag_msg file-annotated-tag >actual && |
3af82863 | 381 | test_cmp expect actual |
ef5a6fb5 CR |
382 | ' |
383 | ||
62e09ce9 CR |
384 | cat >inputmsg <<EOF |
385 | A message from the | |
386 | standard input | |
387 | EOF | |
388 | get_tag_header stdin-annotated-tag $commit commit $time >expect | |
389 | cat inputmsg >>expect | |
390 | test_expect_success 'creating an annotated tag with -F - should succeed' ' | |
d592b315 | 391 | git tag -F - stdin-annotated-tag <inputmsg && |
62e09ce9 | 392 | get_tag_msg stdin-annotated-tag >actual && |
3af82863 | 393 | test_cmp expect actual |
62e09ce9 CR |
394 | ' |
395 | ||
e317cfaf CR |
396 | test_expect_success \ |
397 | 'trying to create a tag with a non-existing -F file should fail' ' | |
398 | ! test -f nonexistingfile && | |
399 | ! tag_exists notag && | |
d592b315 | 400 | test_must_fail git tag -F nonexistingfile notag && |
e317cfaf CR |
401 | ! tag_exists notag |
402 | ' | |
403 | ||
404 | test_expect_success \ | |
39686585 | 405 | 'trying to create tags giving both -m or -F options should fail' ' |
e317cfaf CR |
406 | echo "message file 1" >msgfile1 && |
407 | echo "message file 2" >msgfile2 && | |
408 | ! tag_exists msgtag && | |
d592b315 | 409 | test_must_fail git tag -m "message 1" -F msgfile1 msgtag && |
e317cfaf | 410 | ! tag_exists msgtag && |
d592b315 | 411 | test_must_fail git tag -F msgfile1 -m "message 1" msgtag && |
e317cfaf | 412 | ! tag_exists msgtag && |
d592b315 | 413 | test_must_fail git tag -m "message 1" -F msgfile1 \ |
d492b31c | 414 | -m "message 2" msgtag && |
e317cfaf CR |
415 | ! tag_exists msgtag |
416 | ' | |
417 | ||
ef5a6fb5 CR |
418 | # blank and empty messages: |
419 | ||
420 | get_tag_header empty-annotated-tag $commit commit $time >expect | |
421 | test_expect_success \ | |
422 | 'creating a tag with an empty -m message should succeed' ' | |
d592b315 | 423 | git tag -m "" empty-annotated-tag && |
ef5a6fb5 | 424 | get_tag_msg empty-annotated-tag >actual && |
3af82863 | 425 | test_cmp expect actual |
ef5a6fb5 CR |
426 | ' |
427 | ||
428 | >emptyfile | |
429 | get_tag_header emptyfile-annotated-tag $commit commit $time >expect | |
430 | test_expect_success \ | |
431 | 'creating a tag with an empty -F messagefile should succeed' ' | |
d592b315 | 432 | git tag -F emptyfile emptyfile-annotated-tag && |
ef5a6fb5 | 433 | get_tag_msg emptyfile-annotated-tag >actual && |
3af82863 | 434 | test_cmp expect actual |
ef5a6fb5 CR |
435 | ' |
436 | ||
437 | printf '\n\n \n\t\nLeading blank lines\n' >blanksfile | |
438 | printf '\n\t \t \nRepeated blank lines\n' >>blanksfile | |
439 | printf '\n\n\nTrailing spaces \t \n' >>blanksfile | |
440 | printf '\nTrailing blank lines\n\n\t \n\n' >>blanksfile | |
441 | get_tag_header blanks-annotated-tag $commit commit $time >expect | |
442 | cat >>expect <<EOF | |
443 | Leading blank lines | |
444 | ||
445 | Repeated blank lines | |
446 | ||
447 | Trailing spaces | |
448 | ||
449 | Trailing blank lines | |
450 | EOF | |
451 | test_expect_success \ | |
452 | 'extra blanks in the message for an annotated tag should be removed' ' | |
d592b315 | 453 | git tag -F blanksfile blanks-annotated-tag && |
ef5a6fb5 | 454 | get_tag_msg blanks-annotated-tag >actual && |
3af82863 | 455 | test_cmp expect actual |
ef5a6fb5 CR |
456 | ' |
457 | ||
458 | get_tag_header blank-annotated-tag $commit commit $time >expect | |
459 | test_expect_success \ | |
460 | 'creating a tag with blank -m message with spaces should succeed' ' | |
d592b315 | 461 | git tag -m " " blank-annotated-tag && |
ef5a6fb5 | 462 | get_tag_msg blank-annotated-tag >actual && |
3af82863 | 463 | test_cmp expect actual |
ef5a6fb5 CR |
464 | ' |
465 | ||
466 | echo ' ' >blankfile | |
467 | echo '' >>blankfile | |
468 | echo ' ' >>blankfile | |
469 | get_tag_header blankfile-annotated-tag $commit commit $time >expect | |
470 | test_expect_success \ | |
471 | 'creating a tag with blank -F messagefile with spaces should succeed' ' | |
d592b315 | 472 | git tag -F blankfile blankfile-annotated-tag && |
ef5a6fb5 | 473 | get_tag_msg blankfile-annotated-tag >actual && |
3af82863 | 474 | test_cmp expect actual |
ef5a6fb5 CR |
475 | ' |
476 | ||
477 | printf ' ' >blanknonlfile | |
478 | get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect | |
479 | test_expect_success \ | |
480 | 'creating a tag with -F file of spaces and no newline should succeed' ' | |
d592b315 | 481 | git tag -F blanknonlfile blanknonlfile-annotated-tag && |
ef5a6fb5 | 482 | get_tag_msg blanknonlfile-annotated-tag >actual && |
3af82863 | 483 | test_cmp expect actual |
ef5a6fb5 CR |
484 | ' |
485 | ||
486 | # messages with commented lines: | |
487 | ||
488 | cat >commentsfile <<EOF | |
489 | # A comment | |
490 | ||
491 | ############ | |
492 | The message. | |
493 | ############ | |
494 | One line. | |
495 | ||
496 | ||
497 | # commented lines | |
498 | # commented lines | |
499 | ||
500 | Another line. | |
501 | # comments | |
502 | ||
503 | Last line. | |
504 | EOF | |
505 | get_tag_header comments-annotated-tag $commit commit $time >expect | |
506 | cat >>expect <<EOF | |
507 | The message. | |
508 | One line. | |
509 | ||
510 | Another line. | |
511 | ||
512 | Last line. | |
513 | EOF | |
514 | test_expect_success \ | |
515 | 'creating a tag using a -F messagefile with #comments should succeed' ' | |
d592b315 | 516 | git tag -F commentsfile comments-annotated-tag && |
ef5a6fb5 | 517 | get_tag_msg comments-annotated-tag >actual && |
3af82863 | 518 | test_cmp expect actual |
ef5a6fb5 CR |
519 | ' |
520 | ||
521 | get_tag_header comment-annotated-tag $commit commit $time >expect | |
522 | test_expect_success \ | |
523 | 'creating a tag with a #comment in the -m message should succeed' ' | |
d592b315 | 524 | git tag -m "#comment" comment-annotated-tag && |
ef5a6fb5 | 525 | get_tag_msg comment-annotated-tag >actual && |
3af82863 | 526 | test_cmp expect actual |
ef5a6fb5 CR |
527 | ' |
528 | ||
529 | echo '#comment' >commentfile | |
530 | echo '' >>commentfile | |
531 | echo '####' >>commentfile | |
532 | get_tag_header commentfile-annotated-tag $commit commit $time >expect | |
533 | test_expect_success \ | |
534 | 'creating a tag with #comments in the -F messagefile should succeed' ' | |
d592b315 | 535 | git tag -F commentfile commentfile-annotated-tag && |
ef5a6fb5 | 536 | get_tag_msg commentfile-annotated-tag >actual && |
3af82863 | 537 | test_cmp expect actual |
ef5a6fb5 CR |
538 | ' |
539 | ||
540 | printf '#comment' >commentnonlfile | |
541 | get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect | |
542 | test_expect_success \ | |
543 | 'creating a tag with a file of #comment and no newline should succeed' ' | |
d592b315 | 544 | git tag -F commentnonlfile commentnonlfile-annotated-tag && |
ef5a6fb5 | 545 | get_tag_msg commentnonlfile-annotated-tag >actual && |
3af82863 | 546 | test_cmp expect actual |
ef5a6fb5 CR |
547 | ' |
548 | ||
5206d130 CR |
549 | # listing messages for annotated non-signed tags: |
550 | ||
551 | test_expect_success \ | |
552 | 'listing the one-line message of a non-signed tag should succeed' ' | |
d592b315 | 553 | git tag -m "A msg" tag-one-line && |
5206d130 CR |
554 | |
555 | echo "tag-one-line" >expect && | |
d592b315 | 556 | git tag -l | grep "^tag-one-line" >actual && |
3af82863 | 557 | test_cmp expect actual && |
d592b315 | 558 | git tag -n0 -l | grep "^tag-one-line" >actual && |
3af82863 | 559 | test_cmp expect actual && |
d592b315 | 560 | git tag -n0 -l tag-one-line >actual && |
3af82863 | 561 | test_cmp expect actual && |
5206d130 CR |
562 | |
563 | echo "tag-one-line A msg" >expect && | |
d592b315 | 564 | git tag -n1 -l | grep "^tag-one-line" >actual && |
3af82863 | 565 | test_cmp expect actual && |
d592b315 | 566 | git tag -n -l | grep "^tag-one-line" >actual && |
3af82863 | 567 | test_cmp expect actual && |
d592b315 | 568 | git tag -n1 -l tag-one-line >actual && |
3af82863 | 569 | test_cmp expect actual && |
d592b315 | 570 | git tag -n2 -l tag-one-line >actual && |
3af82863 | 571 | test_cmp expect actual && |
d592b315 | 572 | git tag -n999 -l tag-one-line >actual && |
3af82863 | 573 | test_cmp expect actual |
5206d130 CR |
574 | ' |
575 | ||
576 | test_expect_success \ | |
577 | 'listing the zero-lines message of a non-signed tag should succeed' ' | |
d592b315 | 578 | git tag -m "" tag-zero-lines && |
5206d130 CR |
579 | |
580 | echo "tag-zero-lines" >expect && | |
d592b315 | 581 | git tag -l | grep "^tag-zero-lines" >actual && |
3af82863 | 582 | test_cmp expect actual && |
d592b315 | 583 | git tag -n0 -l | grep "^tag-zero-lines" >actual && |
3af82863 | 584 | test_cmp expect actual && |
d592b315 | 585 | git tag -n0 -l tag-zero-lines >actual && |
3af82863 | 586 | test_cmp expect actual && |
5206d130 CR |
587 | |
588 | echo "tag-zero-lines " >expect && | |
d592b315 | 589 | git tag -n1 -l | grep "^tag-zero-lines" >actual && |
3af82863 | 590 | test_cmp expect actual && |
d592b315 | 591 | git tag -n -l | grep "^tag-zero-lines" >actual && |
3af82863 | 592 | test_cmp expect actual && |
d592b315 | 593 | git tag -n1 -l tag-zero-lines >actual && |
3af82863 | 594 | test_cmp expect actual && |
d592b315 | 595 | git tag -n2 -l tag-zero-lines >actual && |
3af82863 | 596 | test_cmp expect actual && |
d592b315 | 597 | git tag -n999 -l tag-zero-lines >actual && |
3af82863 | 598 | test_cmp expect actual |
5206d130 CR |
599 | ' |
600 | ||
601 | echo 'tag line one' >annotagmsg | |
602 | echo 'tag line two' >>annotagmsg | |
603 | echo 'tag line three' >>annotagmsg | |
604 | test_expect_success \ | |
605 | 'listing many message lines of a non-signed tag should succeed' ' | |
d592b315 | 606 | git tag -F annotagmsg tag-lines && |
5206d130 CR |
607 | |
608 | echo "tag-lines" >expect && | |
d592b315 | 609 | git tag -l | grep "^tag-lines" >actual && |
3af82863 | 610 | test_cmp expect actual && |
d592b315 | 611 | git tag -n0 -l | grep "^tag-lines" >actual && |
3af82863 | 612 | test_cmp expect actual && |
d592b315 | 613 | git tag -n0 -l tag-lines >actual && |
3af82863 | 614 | test_cmp expect actual && |
5206d130 CR |
615 | |
616 | echo "tag-lines tag line one" >expect && | |
d592b315 | 617 | git tag -n1 -l | grep "^tag-lines" >actual && |
3af82863 | 618 | test_cmp expect actual && |
d592b315 | 619 | git tag -n -l | grep "^tag-lines" >actual && |
3af82863 | 620 | test_cmp expect actual && |
d592b315 | 621 | git tag -n1 -l tag-lines >actual && |
3af82863 | 622 | test_cmp expect actual && |
5206d130 CR |
623 | |
624 | echo " tag line two" >>expect && | |
d592b315 | 625 | git tag -n2 -l | grep "^ *tag.line" >actual && |
3af82863 | 626 | test_cmp expect actual && |
d592b315 | 627 | git tag -n2 -l tag-lines >actual && |
3af82863 | 628 | test_cmp expect actual && |
5206d130 CR |
629 | |
630 | echo " tag line three" >>expect && | |
d592b315 | 631 | git tag -n3 -l | grep "^ *tag.line" >actual && |
3af82863 | 632 | test_cmp expect actual && |
d592b315 | 633 | git tag -n3 -l tag-lines >actual && |
3af82863 | 634 | test_cmp expect actual && |
d592b315 | 635 | git tag -n4 -l | grep "^ *tag.line" >actual && |
3af82863 | 636 | test_cmp expect actual && |
d592b315 | 637 | git tag -n4 -l tag-lines >actual && |
3af82863 | 638 | test_cmp expect actual && |
d592b315 | 639 | git tag -n99 -l | grep "^ *tag.line" >actual && |
3af82863 | 640 | test_cmp expect actual && |
d592b315 | 641 | git tag -n99 -l tag-lines >actual && |
3af82863 | 642 | test_cmp expect actual |
5206d130 CR |
643 | ' |
644 | ||
31fd8d72 JH |
645 | test_expect_success 'annotations for blobs are empty' ' |
646 | blob=$(git hash-object -w --stdin <<-\EOF | |
647 | Blob paragraph 1. | |
648 | ||
649 | Blob paragraph 2. | |
650 | EOF | |
651 | ) && | |
652 | git tag tag-blob $blob && | |
653 | echo "tag-blob " >expect && | |
654 | git tag -n1 -l tag-blob >actual && | |
655 | test_cmp expect actual | |
656 | ' | |
657 | ||
ef5a6fb5 CR |
658 | # trying to verify annotated non-signed tags: |
659 | ||
a4df22ce | 660 | test_expect_success GPG \ |
ef5a6fb5 CR |
661 | 'trying to verify an annotated non-signed tag should fail' ' |
662 | tag_exists annotated-tag && | |
d592b315 | 663 | test_must_fail git tag -v annotated-tag |
ef5a6fb5 CR |
664 | ' |
665 | ||
a4df22ce | 666 | test_expect_success GPG \ |
ef5a6fb5 CR |
667 | 'trying to verify a file-annotated non-signed tag should fail' ' |
668 | tag_exists file-annotated-tag && | |
d592b315 | 669 | test_must_fail git tag -v file-annotated-tag |
ef5a6fb5 CR |
670 | ' |
671 | ||
a4df22ce | 672 | test_expect_success GPG \ |
62e09ce9 CR |
673 | 'trying to verify two annotated non-signed tags should fail' ' |
674 | tag_exists annotated-tag file-annotated-tag && | |
d592b315 | 675 | test_must_fail git tag -v annotated-tag file-annotated-tag |
62e09ce9 CR |
676 | ' |
677 | ||
ef5a6fb5 CR |
678 | # creating and verifying signed tags: |
679 | ||
ef5a6fb5 CR |
680 | get_tag_header signed-tag $commit commit $time >expect |
681 | echo 'A signed tag message' >>expect | |
682 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 683 | test_expect_success GPG 'creating a signed tag with -m message should succeed' ' |
d592b315 | 684 | git tag -s -m "A signed tag message" signed-tag && |
ef5a6fb5 | 685 | get_tag_msg signed-tag >actual && |
3af82863 | 686 | test_cmp expect actual |
ef5a6fb5 CR |
687 | ' |
688 | ||
be15f505 LT |
689 | get_tag_header u-signed-tag $commit commit $time >expect |
690 | echo 'Another message' >>expect | |
691 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 692 | test_expect_success GPG 'sign with a given key id' ' |
be15f505 LT |
693 | |
694 | git tag -u committer@example.com -m "Another message" u-signed-tag && | |
695 | get_tag_msg u-signed-tag >actual && | |
3af82863 | 696 | test_cmp expect actual |
be15f505 LT |
697 | |
698 | ' | |
699 | ||
a4df22ce | 700 | test_expect_success GPG 'sign with an unknown id (1)' ' |
be15f505 | 701 | |
d492b31c SB |
702 | test_must_fail git tag -u author@example.com \ |
703 | -m "Another message" o-signed-tag | |
be15f505 LT |
704 | |
705 | ' | |
706 | ||
a4df22ce | 707 | test_expect_success GPG 'sign with an unknown id (2)' ' |
be15f505 | 708 | |
d492b31c | 709 | test_must_fail git tag -u DEADBEEF -m "Another message" o-signed-tag |
be15f505 LT |
710 | |
711 | ' | |
712 | ||
713 | cat >fakeeditor <<'EOF' | |
714 | #!/bin/sh | |
715 | test -n "$1" && exec >"$1" | |
716 | echo A signed tag message | |
717 | echo from a fake editor. | |
718 | EOF | |
719 | chmod +x fakeeditor | |
720 | ||
721 | get_tag_header implied-sign $commit commit $time >expect | |
722 | ./fakeeditor >>expect | |
723 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 724 | test_expect_success GPG '-u implies signed tag' ' |
d592b315 | 725 | GIT_EDITOR=./fakeeditor git tag -u CDDE430D implied-sign && |
be15f505 | 726 | get_tag_msg implied-sign >actual && |
3af82863 | 727 | test_cmp expect actual |
be15f505 LT |
728 | ' |
729 | ||
62e09ce9 CR |
730 | cat >sigmsgfile <<EOF |
731 | Another signed tag | |
732 | message in a file. | |
733 | EOF | |
734 | get_tag_header file-signed-tag $commit commit $time >expect | |
735 | cat sigmsgfile >>expect | |
736 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 737 | test_expect_success GPG \ |
62e09ce9 | 738 | 'creating a signed tag with -F messagefile should succeed' ' |
d592b315 | 739 | git tag -s -F sigmsgfile file-signed-tag && |
62e09ce9 | 740 | get_tag_msg file-signed-tag >actual && |
3af82863 | 741 | test_cmp expect actual |
62e09ce9 CR |
742 | ' |
743 | ||
744 | cat >siginputmsg <<EOF | |
745 | A signed tag message from | |
746 | the standard input | |
747 | EOF | |
748 | get_tag_header stdin-signed-tag $commit commit $time >expect | |
749 | cat siginputmsg >>expect | |
750 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 751 | test_expect_success GPG 'creating a signed tag with -F - should succeed' ' |
d592b315 | 752 | git tag -s -F - stdin-signed-tag <siginputmsg && |
62e09ce9 | 753 | get_tag_msg stdin-signed-tag >actual && |
3af82863 | 754 | test_cmp expect actual |
62e09ce9 CR |
755 | ' |
756 | ||
10507857 JK |
757 | get_tag_header implied-annotate $commit commit $time >expect |
758 | ./fakeeditor >>expect | |
759 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 760 | test_expect_success GPG '-s implies annotated tag' ' |
d592b315 | 761 | GIT_EDITOR=./fakeeditor git tag -s implied-annotate && |
10507857 | 762 | get_tag_msg implied-annotate >actual && |
3af82863 | 763 | test_cmp expect actual |
10507857 JK |
764 | ' |
765 | ||
a4df22ce | 766 | test_expect_success GPG \ |
e317cfaf CR |
767 | 'trying to create a signed tag with non-existing -F file should fail' ' |
768 | ! test -f nonexistingfile && | |
769 | ! tag_exists nosigtag && | |
d592b315 | 770 | test_must_fail git tag -s -F nonexistingfile nosigtag && |
e317cfaf CR |
771 | ! tag_exists nosigtag |
772 | ' | |
773 | ||
a4df22ce | 774 | test_expect_success GPG 'verifying a signed tag should succeed' \ |
d592b315 | 775 | 'git tag -v signed-tag' |
ef5a6fb5 | 776 | |
a4df22ce | 777 | test_expect_success GPG 'verifying two signed tags in one command should succeed' \ |
d592b315 | 778 | 'git tag -v signed-tag file-signed-tag' |
62e09ce9 | 779 | |
a4df22ce | 780 | test_expect_success GPG \ |
62e09ce9 | 781 | 'verifying many signed and non-signed tags should fail' ' |
d592b315 NS |
782 | test_must_fail git tag -v signed-tag annotated-tag && |
783 | test_must_fail git tag -v file-annotated-tag file-signed-tag && | |
784 | test_must_fail git tag -v annotated-tag \ | |
d492b31c | 785 | file-signed-tag file-annotated-tag && |
d592b315 | 786 | test_must_fail git tag -v signed-tag annotated-tag file-signed-tag |
62e09ce9 CR |
787 | ' |
788 | ||
a4df22ce | 789 | test_expect_success GPG 'verifying a forged tag should fail' ' |
ef5a6fb5 CR |
790 | forged=$(git cat-file tag signed-tag | |
791 | sed -e "s/signed-tag/forged-tag/" | | |
792 | git mktag) && | |
793 | git tag forged-tag $forged && | |
d592b315 | 794 | test_must_fail git tag -v forged-tag |
ef5a6fb5 CR |
795 | ' |
796 | ||
797 | # blank and empty messages for signed tags: | |
798 | ||
799 | get_tag_header empty-signed-tag $commit commit $time >expect | |
800 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 801 | test_expect_success GPG \ |
ef5a6fb5 | 802 | 'creating a signed tag with an empty -m message should succeed' ' |
d592b315 | 803 | git tag -s -m "" empty-signed-tag && |
ef5a6fb5 | 804 | get_tag_msg empty-signed-tag >actual && |
3af82863 | 805 | test_cmp expect actual && |
d592b315 | 806 | git tag -v empty-signed-tag |
ef5a6fb5 CR |
807 | ' |
808 | ||
809 | >sigemptyfile | |
810 | get_tag_header emptyfile-signed-tag $commit commit $time >expect | |
811 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 812 | test_expect_success GPG \ |
ef5a6fb5 | 813 | 'creating a signed tag with an empty -F messagefile should succeed' ' |
d592b315 | 814 | git tag -s -F sigemptyfile emptyfile-signed-tag && |
ef5a6fb5 | 815 | get_tag_msg emptyfile-signed-tag >actual && |
3af82863 | 816 | test_cmp expect actual && |
d592b315 | 817 | git tag -v emptyfile-signed-tag |
ef5a6fb5 CR |
818 | ' |
819 | ||
820 | printf '\n\n \n\t\nLeading blank lines\n' > sigblanksfile | |
821 | printf '\n\t \t \nRepeated blank lines\n' >>sigblanksfile | |
822 | printf '\n\n\nTrailing spaces \t \n' >>sigblanksfile | |
823 | printf '\nTrailing blank lines\n\n\t \n\n' >>sigblanksfile | |
824 | get_tag_header blanks-signed-tag $commit commit $time >expect | |
825 | cat >>expect <<EOF | |
826 | Leading blank lines | |
827 | ||
828 | Repeated blank lines | |
829 | ||
830 | Trailing spaces | |
831 | ||
832 | Trailing blank lines | |
833 | EOF | |
834 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 835 | test_expect_success GPG \ |
ef5a6fb5 | 836 | 'extra blanks in the message for a signed tag should be removed' ' |
d592b315 | 837 | git tag -s -F sigblanksfile blanks-signed-tag && |
ef5a6fb5 | 838 | get_tag_msg blanks-signed-tag >actual && |
3af82863 | 839 | test_cmp expect actual && |
d592b315 | 840 | git tag -v blanks-signed-tag |
ef5a6fb5 CR |
841 | ' |
842 | ||
843 | get_tag_header blank-signed-tag $commit commit $time >expect | |
844 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 845 | test_expect_success GPG \ |
ef5a6fb5 | 846 | 'creating a signed tag with a blank -m message should succeed' ' |
d592b315 | 847 | git tag -s -m " " blank-signed-tag && |
ef5a6fb5 | 848 | get_tag_msg blank-signed-tag >actual && |
3af82863 | 849 | test_cmp expect actual && |
d592b315 | 850 | git tag -v blank-signed-tag |
ef5a6fb5 CR |
851 | ' |
852 | ||
853 | echo ' ' >sigblankfile | |
854 | echo '' >>sigblankfile | |
855 | echo ' ' >>sigblankfile | |
856 | get_tag_header blankfile-signed-tag $commit commit $time >expect | |
857 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 858 | test_expect_success GPG \ |
ef5a6fb5 | 859 | 'creating a signed tag with blank -F file with spaces should succeed' ' |
d592b315 | 860 | git tag -s -F sigblankfile blankfile-signed-tag && |
ef5a6fb5 | 861 | get_tag_msg blankfile-signed-tag >actual && |
3af82863 | 862 | test_cmp expect actual && |
d592b315 | 863 | git tag -v blankfile-signed-tag |
ef5a6fb5 CR |
864 | ' |
865 | ||
866 | printf ' ' >sigblanknonlfile | |
867 | get_tag_header blanknonlfile-signed-tag $commit commit $time >expect | |
868 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 869 | test_expect_success GPG \ |
ef5a6fb5 | 870 | 'creating a signed tag with spaces and no newline should succeed' ' |
d592b315 | 871 | git tag -s -F sigblanknonlfile blanknonlfile-signed-tag && |
ef5a6fb5 | 872 | get_tag_msg blanknonlfile-signed-tag >actual && |
3af82863 | 873 | test_cmp expect actual && |
d592b315 | 874 | git tag -v signed-tag |
ef5a6fb5 CR |
875 | ' |
876 | ||
877 | # messages with commented lines for signed tags: | |
878 | ||
879 | cat >sigcommentsfile <<EOF | |
880 | # A comment | |
881 | ||
882 | ############ | |
883 | The message. | |
884 | ############ | |
885 | One line. | |
886 | ||
887 | ||
888 | # commented lines | |
889 | # commented lines | |
890 | ||
891 | Another line. | |
892 | # comments | |
893 | ||
894 | Last line. | |
895 | EOF | |
896 | get_tag_header comments-signed-tag $commit commit $time >expect | |
897 | cat >>expect <<EOF | |
898 | The message. | |
899 | One line. | |
900 | ||
901 | Another line. | |
902 | ||
903 | Last line. | |
904 | EOF | |
905 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 906 | test_expect_success GPG \ |
ef5a6fb5 | 907 | 'creating a signed tag with a -F file with #comments should succeed' ' |
d592b315 | 908 | git tag -s -F sigcommentsfile comments-signed-tag && |
ef5a6fb5 | 909 | get_tag_msg comments-signed-tag >actual && |
3af82863 | 910 | test_cmp expect actual && |
d592b315 | 911 | git tag -v comments-signed-tag |
ef5a6fb5 CR |
912 | ' |
913 | ||
914 | get_tag_header comment-signed-tag $commit commit $time >expect | |
915 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 916 | test_expect_success GPG \ |
ef5a6fb5 | 917 | 'creating a signed tag with #commented -m message should succeed' ' |
d592b315 | 918 | git tag -s -m "#comment" comment-signed-tag && |
ef5a6fb5 | 919 | get_tag_msg comment-signed-tag >actual && |
3af82863 | 920 | test_cmp expect actual && |
d592b315 | 921 | git tag -v comment-signed-tag |
ef5a6fb5 CR |
922 | ' |
923 | ||
924 | echo '#comment' >sigcommentfile | |
925 | echo '' >>sigcommentfile | |
926 | echo '####' >>sigcommentfile | |
927 | get_tag_header commentfile-signed-tag $commit commit $time >expect | |
928 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 929 | test_expect_success GPG \ |
ef5a6fb5 | 930 | 'creating a signed tag with #commented -F messagefile should succeed' ' |
d592b315 | 931 | git tag -s -F sigcommentfile commentfile-signed-tag && |
ef5a6fb5 | 932 | get_tag_msg commentfile-signed-tag >actual && |
3af82863 | 933 | test_cmp expect actual && |
d592b315 | 934 | git tag -v commentfile-signed-tag |
ef5a6fb5 CR |
935 | ' |
936 | ||
937 | printf '#comment' >sigcommentnonlfile | |
938 | get_tag_header commentnonlfile-signed-tag $commit commit $time >expect | |
939 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 940 | test_expect_success GPG \ |
ef5a6fb5 | 941 | 'creating a signed tag with a #comment and no newline should succeed' ' |
d592b315 | 942 | git tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && |
ef5a6fb5 | 943 | get_tag_msg commentnonlfile-signed-tag >actual && |
3af82863 | 944 | test_cmp expect actual && |
d592b315 | 945 | git tag -v commentnonlfile-signed-tag |
ef5a6fb5 CR |
946 | ' |
947 | ||
5206d130 CR |
948 | # listing messages for signed tags: |
949 | ||
a4df22ce | 950 | test_expect_success GPG \ |
5206d130 | 951 | 'listing the one-line message of a signed tag should succeed' ' |
d592b315 | 952 | git tag -s -m "A message line signed" stag-one-line && |
5206d130 CR |
953 | |
954 | echo "stag-one-line" >expect && | |
d592b315 | 955 | git tag -l | grep "^stag-one-line" >actual && |
3af82863 | 956 | test_cmp expect actual && |
d592b315 | 957 | git tag -n0 -l | grep "^stag-one-line" >actual && |
3af82863 | 958 | test_cmp expect actual && |
d592b315 | 959 | git tag -n0 -l stag-one-line >actual && |
3af82863 | 960 | test_cmp expect actual && |
5206d130 CR |
961 | |
962 | echo "stag-one-line A message line signed" >expect && | |
d592b315 | 963 | git tag -n1 -l | grep "^stag-one-line" >actual && |
3af82863 | 964 | test_cmp expect actual && |
d592b315 | 965 | git tag -n -l | grep "^stag-one-line" >actual && |
3af82863 | 966 | test_cmp expect actual && |
d592b315 | 967 | git tag -n1 -l stag-one-line >actual && |
3af82863 | 968 | test_cmp expect actual && |
d592b315 | 969 | git tag -n2 -l stag-one-line >actual && |
3af82863 | 970 | test_cmp expect actual && |
d592b315 | 971 | git tag -n999 -l stag-one-line >actual && |
3af82863 | 972 | test_cmp expect actual |
5206d130 CR |
973 | ' |
974 | ||
a4df22ce | 975 | test_expect_success GPG \ |
5206d130 | 976 | 'listing the zero-lines message of a signed tag should succeed' ' |
d592b315 | 977 | git tag -s -m "" stag-zero-lines && |
5206d130 CR |
978 | |
979 | echo "stag-zero-lines" >expect && | |
d592b315 | 980 | git tag -l | grep "^stag-zero-lines" >actual && |
3af82863 | 981 | test_cmp expect actual && |
d592b315 | 982 | git tag -n0 -l | grep "^stag-zero-lines" >actual && |
3af82863 | 983 | test_cmp expect actual && |
d592b315 | 984 | git tag -n0 -l stag-zero-lines >actual && |
3af82863 | 985 | test_cmp expect actual && |
5206d130 CR |
986 | |
987 | echo "stag-zero-lines " >expect && | |
d592b315 | 988 | git tag -n1 -l | grep "^stag-zero-lines" >actual && |
3af82863 | 989 | test_cmp expect actual && |
d592b315 | 990 | git tag -n -l | grep "^stag-zero-lines" >actual && |
3af82863 | 991 | test_cmp expect actual && |
d592b315 | 992 | git tag -n1 -l stag-zero-lines >actual && |
3af82863 | 993 | test_cmp expect actual && |
d592b315 | 994 | git tag -n2 -l stag-zero-lines >actual && |
3af82863 | 995 | test_cmp expect actual && |
d592b315 | 996 | git tag -n999 -l stag-zero-lines >actual && |
3af82863 | 997 | test_cmp expect actual |
5206d130 CR |
998 | ' |
999 | ||
1000 | echo 'stag line one' >sigtagmsg | |
1001 | echo 'stag line two' >>sigtagmsg | |
1002 | echo 'stag line three' >>sigtagmsg | |
a4df22ce | 1003 | test_expect_success GPG \ |
5206d130 | 1004 | 'listing many message lines of a signed tag should succeed' ' |
d592b315 | 1005 | git tag -s -F sigtagmsg stag-lines && |
5206d130 CR |
1006 | |
1007 | echo "stag-lines" >expect && | |
d592b315 | 1008 | git tag -l | grep "^stag-lines" >actual && |
3af82863 | 1009 | test_cmp expect actual && |
d592b315 | 1010 | git tag -n0 -l | grep "^stag-lines" >actual && |
3af82863 | 1011 | test_cmp expect actual && |
d592b315 | 1012 | git tag -n0 -l stag-lines >actual && |
3af82863 | 1013 | test_cmp expect actual && |
5206d130 CR |
1014 | |
1015 | echo "stag-lines stag line one" >expect && | |
d592b315 | 1016 | git tag -n1 -l | grep "^stag-lines" >actual && |
3af82863 | 1017 | test_cmp expect actual && |
d592b315 | 1018 | git tag -n -l | grep "^stag-lines" >actual && |
3af82863 | 1019 | test_cmp expect actual && |
d592b315 | 1020 | git tag -n1 -l stag-lines >actual && |
3af82863 | 1021 | test_cmp expect actual && |
5206d130 CR |
1022 | |
1023 | echo " stag line two" >>expect && | |
d592b315 | 1024 | git tag -n2 -l | grep "^ *stag.line" >actual && |
3af82863 | 1025 | test_cmp expect actual && |
d592b315 | 1026 | git tag -n2 -l stag-lines >actual && |
3af82863 | 1027 | test_cmp expect actual && |
5206d130 CR |
1028 | |
1029 | echo " stag line three" >>expect && | |
d592b315 | 1030 | git tag -n3 -l | grep "^ *stag.line" >actual && |
3af82863 | 1031 | test_cmp expect actual && |
d592b315 | 1032 | git tag -n3 -l stag-lines >actual && |
3af82863 | 1033 | test_cmp expect actual && |
d592b315 | 1034 | git tag -n4 -l | grep "^ *stag.line" >actual && |
3af82863 | 1035 | test_cmp expect actual && |
d592b315 | 1036 | git tag -n4 -l stag-lines >actual && |
3af82863 | 1037 | test_cmp expect actual && |
d592b315 | 1038 | git tag -n99 -l | grep "^ *stag.line" >actual && |
3af82863 | 1039 | test_cmp expect actual && |
d592b315 | 1040 | git tag -n99 -l stag-lines >actual && |
3af82863 | 1041 | test_cmp expect actual |
5206d130 CR |
1042 | ' |
1043 | ||
ef5a6fb5 CR |
1044 | # tags pointing to objects different from commits: |
1045 | ||
1046 | tree=$(git rev-parse HEAD^{tree}) | |
1047 | blob=$(git rev-parse HEAD:foo) | |
a4df22ce | 1048 | tag=$(git rev-parse signed-tag 2>/dev/null) |
ef5a6fb5 CR |
1049 | |
1050 | get_tag_header tree-signed-tag $tree tree $time >expect | |
1051 | echo "A message for a tree" >>expect | |
1052 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 1053 | test_expect_success GPG \ |
ef5a6fb5 | 1054 | 'creating a signed tag pointing to a tree should succeed' ' |
d592b315 | 1055 | git tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && |
ef5a6fb5 | 1056 | get_tag_msg tree-signed-tag >actual && |
3af82863 | 1057 | test_cmp expect actual |
ef5a6fb5 CR |
1058 | ' |
1059 | ||
1060 | get_tag_header blob-signed-tag $blob blob $time >expect | |
1061 | echo "A message for a blob" >>expect | |
1062 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 1063 | test_expect_success GPG \ |
ef5a6fb5 | 1064 | 'creating a signed tag pointing to a blob should succeed' ' |
d592b315 | 1065 | git tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && |
ef5a6fb5 | 1066 | get_tag_msg blob-signed-tag >actual && |
3af82863 | 1067 | test_cmp expect actual |
ef5a6fb5 CR |
1068 | ' |
1069 | ||
1070 | get_tag_header tag-signed-tag $tag tag $time >expect | |
1071 | echo "A message for another tag" >>expect | |
1072 | echo '-----BEGIN PGP SIGNATURE-----' >>expect | |
a4df22ce | 1073 | test_expect_success GPG \ |
ef5a6fb5 | 1074 | 'creating a signed tag pointing to another tag should succeed' ' |
d592b315 | 1075 | git tag -s -m "A message for another tag" tag-signed-tag signed-tag && |
ef5a6fb5 | 1076 | get_tag_msg tag-signed-tag >actual && |
3af82863 | 1077 | test_cmp expect actual |
ef5a6fb5 CR |
1078 | ' |
1079 | ||
c8525c30 | 1080 | # usage with rfc1991 signatures |
c8525c30 MG |
1081 | get_tag_header rfc1991-signed-tag $commit commit $time >expect |
1082 | echo "RFC1991 signed tag" >>expect | |
1083 | echo '-----BEGIN PGP MESSAGE-----' >>expect | |
1084 | test_expect_success GPG \ | |
1085 | 'creating a signed tag with rfc1991' ' | |
086cb911 | 1086 | echo "rfc1991" >gpghome/gpg.conf && |
c8525c30 MG |
1087 | git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit && |
1088 | get_tag_msg rfc1991-signed-tag >actual && | |
1089 | test_cmp expect actual | |
1090 | ' | |
1091 | ||
1092 | cat >fakeeditor <<'EOF' | |
1093 | #!/bin/sh | |
1094 | cp "$1" actual | |
1095 | EOF | |
1096 | chmod +x fakeeditor | |
1097 | ||
3d5854e7 | 1098 | test_expect_success GPG \ |
c8525c30 | 1099 | 'reediting a signed tag body omits signature' ' |
086cb911 | 1100 | echo "rfc1991" >gpghome/gpg.conf && |
c8525c30 MG |
1101 | echo "RFC1991 signed tag" >expect && |
1102 | GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit && | |
1103 | test_cmp expect actual | |
1104 | ' | |
1105 | ||
3d5854e7 | 1106 | test_expect_success GPG \ |
c8525c30 | 1107 | 'verifying rfc1991 signature' ' |
086cb911 | 1108 | echo "rfc1991" >gpghome/gpg.conf && |
c8525c30 MG |
1109 | git tag -v rfc1991-signed-tag |
1110 | ' | |
1111 | ||
3d5854e7 | 1112 | test_expect_success GPG \ |
c8525c30 | 1113 | 'list tag with rfc1991 signature' ' |
086cb911 | 1114 | echo "rfc1991" >gpghome/gpg.conf && |
c8525c30 MG |
1115 | echo "rfc1991-signed-tag RFC1991 signed tag" >expect && |
1116 | git tag -l -n1 rfc1991-signed-tag >actual && | |
1117 | test_cmp expect actual && | |
1118 | git tag -l -n2 rfc1991-signed-tag >actual && | |
1119 | test_cmp expect actual && | |
1120 | git tag -l -n999 rfc1991-signed-tag >actual && | |
1121 | test_cmp expect actual | |
1122 | ' | |
1123 | ||
1124 | rm -f gpghome/gpg.conf | |
1125 | ||
3d5854e7 | 1126 | test_expect_success GPG \ |
c8525c30 MG |
1127 | 'verifying rfc1991 signature without --rfc1991' ' |
1128 | git tag -v rfc1991-signed-tag | |
1129 | ' | |
1130 | ||
3d5854e7 | 1131 | test_expect_success GPG \ |
c8525c30 MG |
1132 | 'list tag with rfc1991 signature without --rfc1991' ' |
1133 | echo "rfc1991-signed-tag RFC1991 signed tag" >expect && | |
1134 | git tag -l -n1 rfc1991-signed-tag >actual && | |
1135 | test_cmp expect actual && | |
1136 | git tag -l -n2 rfc1991-signed-tag >actual && | |
1137 | test_cmp expect actual && | |
1138 | git tag -l -n999 rfc1991-signed-tag >actual && | |
1139 | test_cmp expect actual | |
1140 | ' | |
1141 | ||
3d5854e7 | 1142 | test_expect_success GPG \ |
c8525c30 MG |
1143 | 'reediting a signed tag body omits signature' ' |
1144 | echo "RFC1991 signed tag" >expect && | |
1145 | GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit && | |
1146 | test_cmp expect actual | |
1147 | ' | |
1148 | ||
aba91192 CR |
1149 | # try to sign with bad user.signingkey |
1150 | git config user.signingkey BobTheMouse | |
a4df22ce | 1151 | test_expect_success GPG \ |
d592b315 | 1152 | 'git tag -s fails if gpg is misconfigured' \ |
d492b31c | 1153 | 'test_must_fail git tag -s -m tail tag-gpg-failure' |
aba91192 CR |
1154 | git config --unset user.signingkey |
1155 | ||
ef5a6fb5 CR |
1156 | # try to verify without gpg: |
1157 | ||
1158 | rm -rf gpghome | |
a4df22ce | 1159 | test_expect_success GPG \ |
ef5a6fb5 | 1160 | 'verify signed tag fails when public key is not present' \ |
d592b315 | 1161 | 'test_must_fail git tag -v signed-tag' |
ef5a6fb5 | 1162 | |
41ac414e | 1163 | test_expect_success \ |
d592b315 | 1164 | 'git tag -a fails if tag annotation is empty' ' |
41ac414e | 1165 | ! (GIT_EDITOR=cat git tag -a initial-comment) |
eb9d2b91 MH |
1166 | ' |
1167 | ||
4d8b1dc8 MH |
1168 | test_expect_success \ |
1169 | 'message in editor has initial comment' ' | |
5649bd9a ÆAB |
1170 | ! (GIT_EDITOR=cat git tag -a initial-comment > actual) |
1171 | ' | |
1172 | ||
b3e1900a | 1173 | test_expect_success 'message in editor has initial comment: first line' ' |
eb9d2b91 | 1174 | # check the first line --- should be empty |
5649bd9a ÆAB |
1175 | echo >first.expect && |
1176 | sed -e 1q <actual >first.actual && | |
b3e1900a | 1177 | test_i18ncmp first.expect first.actual |
5649bd9a ÆAB |
1178 | ' |
1179 | ||
1180 | test_expect_success \ | |
1181 | 'message in editor has initial comment: remainder' ' | |
eb9d2b91 | 1182 | # remove commented lines from the remainder -- should be empty |
5649bd9a ÆAB |
1183 | >rest.expect |
1184 | sed -e 1d -e '/^#/d' <actual >rest.actual && | |
1185 | test_cmp rest.expect rest.actual | |
4d8b1dc8 MH |
1186 | ' |
1187 | ||
1188 | get_tag_header reuse $commit commit $time >expect | |
1189 | echo "An annotation to be reused" >> expect | |
1190 | test_expect_success \ | |
1191 | 'overwriting an annoted tag should use its previous body' ' | |
1192 | git tag -a -m "An annotation to be reused" reuse && | |
1193 | GIT_EDITOR=true git tag -f -a reuse && | |
1194 | get_tag_msg reuse >actual && | |
3af82863 | 1195 | test_cmp expect actual |
4d8b1dc8 MH |
1196 | ' |
1197 | ||
dbd0f5c7 JH |
1198 | test_expect_success 'filename for the message is relative to cwd' ' |
1199 | mkdir subdir && | |
1200 | echo "Tag message in top directory" >msgfile-5 && | |
1201 | echo "Tag message in sub directory" >subdir/msgfile-5 && | |
1202 | ( | |
1203 | cd subdir && | |
1204 | git tag -a -F msgfile-5 tag-from-subdir | |
1205 | ) && | |
1206 | git cat-file tag tag-from-subdir | grep "in sub directory" | |
1207 | ' | |
1208 | ||
1209 | test_expect_success 'filename for the message is relative to cwd' ' | |
1210 | echo "Tag message in sub directory" >subdir/msgfile-6 && | |
1211 | ( | |
1212 | cd subdir && | |
1213 | git tag -a -F msgfile-6 tag-from-subdir-2 | |
1214 | ) && | |
1215 | git cat-file tag tag-from-subdir-2 | grep "in sub directory" | |
1216 | ' | |
1217 | ||
32c35cfb JG |
1218 | # create a few more commits to test --contains |
1219 | ||
1220 | hash1=$(git rev-parse HEAD) | |
1221 | ||
1222 | test_expect_success 'creating second commit and tag' ' | |
1223 | echo foo-2.0 >foo && | |
1224 | git add foo && | |
2dec68cf | 1225 | git commit -m second && |
32c35cfb JG |
1226 | git tag v2.0 |
1227 | ' | |
1228 | ||
1229 | hash2=$(git rev-parse HEAD) | |
1230 | ||
1231 | test_expect_success 'creating third commit without tag' ' | |
1232 | echo foo-dev >foo && | |
1233 | git add foo && | |
1234 | git commit -m third | |
1235 | ' | |
1236 | ||
1237 | hash3=$(git rev-parse HEAD) | |
1238 | ||
1239 | # simple linear checks of --continue | |
1240 | ||
1241 | cat > expected <<EOF | |
1242 | v0.2.1 | |
1243 | v1.0 | |
1244 | v1.0.1 | |
1245 | v1.1.3 | |
1246 | v2.0 | |
1247 | EOF | |
1248 | ||
1249 | test_expect_success 'checking that first commit is in all tags (hash)' " | |
2dec68cf | 1250 | git tag -l --contains $hash1 v* >actual && |
32c35cfb JG |
1251 | test_cmp expected actual |
1252 | " | |
1253 | ||
1254 | # other ways of specifying the commit | |
1255 | test_expect_success 'checking that first commit is in all tags (tag)' " | |
2dec68cf | 1256 | git tag -l --contains v1.0 v* >actual && |
32c35cfb JG |
1257 | test_cmp expected actual |
1258 | " | |
1259 | ||
1260 | test_expect_success 'checking that first commit is in all tags (relative)' " | |
2dec68cf | 1261 | git tag -l --contains HEAD~2 v* >actual && |
32c35cfb JG |
1262 | test_cmp expected actual |
1263 | " | |
1264 | ||
1265 | cat > expected <<EOF | |
1266 | v2.0 | |
1267 | EOF | |
1268 | ||
1269 | test_expect_success 'checking that second commit only has one tag' " | |
2dec68cf | 1270 | git tag -l --contains $hash2 v* >actual && |
32c35cfb JG |
1271 | test_cmp expected actual |
1272 | " | |
1273 | ||
1274 | ||
1275 | cat > expected <<EOF | |
1276 | EOF | |
1277 | ||
1278 | test_expect_success 'checking that third commit has no tags' " | |
2dec68cf | 1279 | git tag -l --contains $hash3 v* >actual && |
32c35cfb JG |
1280 | test_cmp expected actual |
1281 | " | |
1282 | ||
1283 | # how about a simple merge? | |
1284 | ||
1285 | test_expect_success 'creating simple branch' ' | |
1286 | git branch stable v2.0 && | |
1287 | git checkout stable && | |
1288 | echo foo-3.0 > foo && | |
2dec68cf | 1289 | git commit foo -m fourth && |
32c35cfb JG |
1290 | git tag v3.0 |
1291 | ' | |
1292 | ||
1293 | hash4=$(git rev-parse HEAD) | |
1294 | ||
1295 | cat > expected <<EOF | |
1296 | v3.0 | |
1297 | EOF | |
1298 | ||
1299 | test_expect_success 'checking that branch head only has one tag' " | |
2dec68cf | 1300 | git tag -l --contains $hash4 v* >actual && |
32c35cfb JG |
1301 | test_cmp expected actual |
1302 | " | |
1303 | ||
1304 | test_expect_success 'merging original branch into this branch' ' | |
1305 | git merge --strategy=ours master && | |
1306 | git tag v4.0 | |
1307 | ' | |
1308 | ||
1309 | cat > expected <<EOF | |
1310 | v4.0 | |
1311 | EOF | |
1312 | ||
1313 | test_expect_success 'checking that original branch head has one tag now' " | |
2dec68cf | 1314 | git tag -l --contains $hash3 v* >actual && |
32c35cfb JG |
1315 | test_cmp expected actual |
1316 | " | |
1317 | ||
1318 | cat > expected <<EOF | |
1319 | v0.2.1 | |
1320 | v1.0 | |
1321 | v1.0.1 | |
1322 | v1.1.3 | |
1323 | v2.0 | |
1324 | v3.0 | |
1325 | v4.0 | |
1326 | EOF | |
1327 | ||
1328 | test_expect_success 'checking that initial commit is in all tags' " | |
2dec68cf | 1329 | git tag -l --contains $hash1 v* >actual && |
32c35cfb JG |
1330 | test_cmp expected actual |
1331 | " | |
1332 | ||
e0e03a73 ST |
1333 | # mixing modes and options: |
1334 | ||
1335 | test_expect_success 'mixing incompatibles modes and options is forbidden' ' | |
2dec68cf JN |
1336 | test_must_fail git tag -a && |
1337 | test_must_fail git tag -l -v && | |
1338 | test_must_fail git tag -n 100 && | |
1339 | test_must_fail git tag -l -m msg && | |
1340 | test_must_fail git tag -l -F some file && | |
e0e03a73 ST |
1341 | test_must_fail git tag -v -s |
1342 | ' | |
1343 | ||
ae7706b9 TG |
1344 | # check points-at |
1345 | ||
1346 | test_expect_success '--points-at cannot be used in non-list mode' ' | |
1347 | test_must_fail git tag --points-at=v4.0 foo | |
1348 | ' | |
1349 | ||
1350 | test_expect_success '--points-at finds lightweight tags' ' | |
1351 | echo v4.0 >expect && | |
1352 | git tag --points-at v4.0 >actual && | |
1353 | test_cmp expect actual | |
1354 | ' | |
1355 | ||
1356 | test_expect_success '--points-at finds annotated tags of commits' ' | |
1357 | git tag -m "v4.0, annotated" annotated-v4.0 v4.0 && | |
1358 | echo annotated-v4.0 >expect && | |
1359 | git tag -l --points-at v4.0 "annotated*" >actual && | |
1360 | test_cmp expect actual | |
1361 | ' | |
1362 | ||
1363 | test_expect_success '--points-at finds annotated tags of tags' ' | |
1364 | git tag -m "describing the v4.0 tag object" \ | |
1365 | annotated-again-v4.0 annotated-v4.0 && | |
1366 | cat >expect <<-\EOF && | |
1367 | annotated-again-v4.0 | |
1368 | annotated-v4.0 | |
1369 | EOF | |
1370 | git tag --points-at=annotated-v4.0 >actual && | |
1371 | test_cmp expect actual | |
1372 | ' | |
1373 | ||
1374 | test_expect_success 'multiple --points-at are OR-ed together' ' | |
1375 | cat >expect <<-\EOF && | |
1376 | v2.0 | |
1377 | v3.0 | |
1378 | EOF | |
1379 | git tag --points-at=v2.0 --points-at=v3.0 >actual && | |
1380 | test_cmp expect actual | |
1381 | ' | |
1382 | ||
9ef176b5 NTND |
1383 | test_expect_success 'lexical sort' ' |
1384 | git tag foo1.3 && | |
1385 | git tag foo1.6 && | |
1386 | git tag foo1.10 && | |
1387 | git tag -l --sort=refname "foo*" >actual && | |
dc662d44 JK |
1388 | cat >expect <<-\EOF && |
1389 | foo1.10 | |
1390 | foo1.3 | |
1391 | foo1.6 | |
1392 | EOF | |
9ef176b5 NTND |
1393 | test_cmp expect actual |
1394 | ' | |
1395 | ||
1396 | test_expect_success 'version sort' ' | |
1397 | git tag -l --sort=version:refname "foo*" >actual && | |
dc662d44 JK |
1398 | cat >expect <<-\EOF && |
1399 | foo1.3 | |
1400 | foo1.6 | |
1401 | foo1.10 | |
1402 | EOF | |
9ef176b5 NTND |
1403 | test_cmp expect actual |
1404 | ' | |
1405 | ||
1406 | test_expect_success 'reverse version sort' ' | |
1407 | git tag -l --sort=-version:refname "foo*" >actual && | |
dc662d44 JK |
1408 | cat >expect <<-\EOF && |
1409 | foo1.10 | |
1410 | foo1.6 | |
1411 | foo1.3 | |
1412 | EOF | |
9ef176b5 NTND |
1413 | test_cmp expect actual |
1414 | ' | |
1415 | ||
1416 | test_expect_success 'reverse lexical sort' ' | |
1417 | git tag -l --sort=-refname "foo*" >actual && | |
dc662d44 JK |
1418 | cat >expect <<-\EOF && |
1419 | foo1.6 | |
1420 | foo1.3 | |
1421 | foo1.10 | |
1422 | EOF | |
9ef176b5 NTND |
1423 | test_cmp expect actual |
1424 | ' | |
1425 | ||
b150794d JK |
1426 | test_expect_success 'configured lexical sort' ' |
1427 | git config tag.sort "v:refname" && | |
1428 | git tag -l "foo*" >actual && | |
1429 | cat >expect <<-\EOF && | |
1430 | foo1.3 | |
1431 | foo1.6 | |
1432 | foo1.10 | |
1433 | EOF | |
1434 | test_cmp expect actual | |
1435 | ' | |
1436 | ||
1437 | test_expect_success 'option override configured sort' ' | |
1438 | git tag -l --sort=-refname "foo*" >actual && | |
1439 | cat >expect <<-\EOF && | |
1440 | foo1.6 | |
1441 | foo1.3 | |
1442 | foo1.10 | |
1443 | EOF | |
1444 | test_cmp expect actual | |
1445 | ' | |
1446 | ||
1447 | test_expect_success 'invalid sort parameter on command line' ' | |
1448 | test_must_fail git tag -l --sort=notvalid "foo*" >actual | |
1449 | ' | |
1450 | ||
1451 | test_expect_success 'invalid sort parameter in configuratoin' ' | |
1452 | git config tag.sort "v:notvalid" && | |
1453 | git tag -l "foo*" >actual && | |
1454 | cat >expect <<-\EOF && | |
1455 | foo1.10 | |
1456 | foo1.3 | |
1457 | foo1.6 | |
1458 | EOF | |
1459 | test_cmp expect actual | |
1460 | ' | |
1461 | ||
cbc60b67 JJL |
1462 | run_with_limited_stack () { |
1463 | (ulimit -s 64 && "$@") | |
1464 | } | |
1465 | ||
1466 | test_lazy_prereq ULIMIT 'run_with_limited_stack true' | |
1467 | ||
1468 | # we require ulimit, this excludes Windows | |
1469 | test_expect_success ULIMIT '--contains works in a deep repo' ' | |
1470 | >expect && | |
1471 | i=1 && | |
1472 | while test $i -lt 4000 | |
1473 | do | |
1474 | echo "commit refs/heads/master | |
1475 | committer A U Thor <author@example.com> $((1000000000 + $i * 100)) +0200 | |
1476 | data <<EOF | |
1477 | commit #$i | |
1478 | EOF" | |
1479 | test $i = 1 && echo "from refs/heads/master^0" | |
1480 | i=$(($i + 1)) | |
1481 | done | git fast-import && | |
1482 | git checkout master && | |
1483 | git tag far-far-away HEAD^ && | |
1484 | run_with_limited_stack git tag --contains HEAD >actual && | |
1485 | test_cmp expect actual | |
1486 | ' | |
1487 | ||
ef5a6fb5 | 1488 | test_done |