1#!/bin/sh
2#
3# Copyright (c) 2007 Andy Parkins
4#
5
6test_description='for-each-ref test'
7
8. ./test-lib.sh
9. "$TEST_DIRECTORY"/lib-gpg.sh
10
11# Mon Jul 3 23:18:43 2006 +0000
12datestamp=1151968723
13setdate_and_increment () {
14 GIT_COMMITTER_DATE="$datestamp +0200"
15 datestamp=$(expr "$datestamp" + 1)
16 GIT_AUTHOR_DATE="$datestamp +0200"
17 datestamp=$(expr "$datestamp" + 1)
18 export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
19}
20
21test_expect_success setup '
22 setdate_and_increment &&
23 echo "Using $datestamp" > one &&
24 git add one &&
25 git commit -m "Initial" &&
26 setdate_and_increment &&
27 git tag -a -m "Tagging at $datestamp" testtag &&
28 git update-ref refs/remotes/origin/master master &&
29 git remote add origin nowhere &&
30 git config branch.master.remote origin &&
31 git config branch.master.merge refs/heads/master &&
32 git remote add myfork elsewhere &&
33 git config remote.pushdefault myfork &&
34 git config push.default current
35'
36
37test_atom() {
38 case "$1" in
39 head) ref=refs/heads/master ;;
40 tag) ref=refs/tags/testtag ;;
41 sym) ref=refs/heads/sym ;;
42 *) ref=$1 ;;
43 esac
44 printf '%s\n' "$3" >expected
45 test_expect_${4:-success} $PREREQ "basic atom: $1 $2" "
46 git for-each-ref --format='%($2)' $ref >actual &&
47 sanitize_pgp <actual >actual.clean &&
48 test_cmp expected actual.clean
49 "
50}
51
52test_atom head refname refs/heads/master
53test_atom head refname:short master
54test_atom head refname:lstrip=1 heads/master
55test_atom head refname:lstrip=2 master
56test_atom head refname:lstrip=-1 master
57test_atom head refname:lstrip=-2 heads/master
58test_atom head refname:rstrip=1 refs/heads
59test_atom head refname:rstrip=2 refs
60test_atom head refname:rstrip=-1 refs
61test_atom head refname:rstrip=-2 refs/heads
62test_atom head refname:strip=1 heads/master
63test_atom head refname:strip=2 master
64test_atom head refname:strip=-1 master
65test_atom head refname:strip=-2 heads/master
66test_atom head upstream refs/remotes/origin/master
67test_atom head upstream:short origin/master
68test_atom head upstream:lstrip=2 origin/master
69test_atom head upstream:lstrip=-2 origin/master
70test_atom head upstream:rstrip=2 refs/remotes
71test_atom head upstream:rstrip=-2 refs/remotes
72test_atom head upstream:strip=2 origin/master
73test_atom head upstream:strip=-2 origin/master
74test_atom head push refs/remotes/myfork/master
75test_atom head push:short myfork/master
76test_atom head push:lstrip=1 remotes/myfork/master
77test_atom head push:lstrip=-1 master
78test_atom head push:rstrip=1 refs/remotes/myfork
79test_atom head push:rstrip=-1 refs
80test_atom head push:strip=1 remotes/myfork/master
81test_atom head push:strip=-1 master
82test_atom head objecttype commit
83test_atom head objectsize 171
84test_atom head objectname $(git rev-parse refs/heads/master)
85test_atom head objectname:short $(git rev-parse --short refs/heads/master)
86test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
87test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
88test_atom head tree $(git rev-parse refs/heads/master^{tree})
89test_atom head parent ''
90test_atom head numparent 0
91test_atom head object ''
92test_atom head type ''
93test_atom head '*objectname' ''
94test_atom head '*objecttype' ''
95test_atom head author 'A U Thor <author@example.com> 1151968724 +0200'
96test_atom head authorname 'A U Thor'
97test_atom head authoremail '<author@example.com>'
98test_atom head authordate 'Tue Jul 4 01:18:44 2006 +0200'
99test_atom head committer 'C O Mitter <committer@example.com> 1151968723 +0200'
100test_atom head committername 'C O Mitter'
101test_atom head committeremail '<committer@example.com>'
102test_atom head committerdate 'Tue Jul 4 01:18:43 2006 +0200'
103test_atom head tag ''
104test_atom head tagger ''
105test_atom head taggername ''
106test_atom head taggeremail ''
107test_atom head taggerdate ''
108test_atom head creator 'C O Mitter <committer@example.com> 1151968723 +0200'
109test_atom head creatordate 'Tue Jul 4 01:18:43 2006 +0200'
110test_atom head subject 'Initial'
111test_atom head contents:subject 'Initial'
112test_atom head body ''
113test_atom head contents:body ''
114test_atom head contents:signature ''
115test_atom head contents 'Initial
116'
117test_atom head HEAD '*'
118
119test_atom tag refname refs/tags/testtag
120test_atom tag refname:short testtag
121test_atom tag upstream ''
122test_atom tag push ''
123test_atom tag objecttype tag
124test_atom tag objectsize 154
125test_atom tag objectname $(git rev-parse refs/tags/testtag)
126test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag)
127test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
128test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
129test_atom tag tree ''
130test_atom tag parent ''
131test_atom tag numparent ''
132test_atom tag object $(git rev-parse refs/tags/testtag^0)
133test_atom tag type 'commit'
134test_atom tag '*objectname' 'ea122842f48be4afb2d1fc6a4b96c05885ab7463'
135test_atom tag '*objecttype' 'commit'
136test_atom tag author ''
137test_atom tag authorname ''
138test_atom tag authoremail ''
139test_atom tag authordate ''
140test_atom tag committer ''
141test_atom tag committername ''
142test_atom tag committeremail ''
143test_atom tag committerdate ''
144test_atom tag tag 'testtag'
145test_atom tag tagger 'C O Mitter <committer@example.com> 1151968725 +0200'
146test_atom tag taggername 'C O Mitter'
147test_atom tag taggeremail '<committer@example.com>'
148test_atom tag taggerdate 'Tue Jul 4 01:18:45 2006 +0200'
149test_atom tag creator 'C O Mitter <committer@example.com> 1151968725 +0200'
150test_atom tag creatordate 'Tue Jul 4 01:18:45 2006 +0200'
151test_atom tag subject 'Tagging at 1151968727'
152test_atom tag contents:subject 'Tagging at 1151968727'
153test_atom tag body ''
154test_atom tag contents:body ''
155test_atom tag contents:signature ''
156test_atom tag contents 'Tagging at 1151968727
157'
158test_atom tag HEAD ' '
159
160test_expect_success 'Check invalid atoms names are errors' '
161 test_must_fail git for-each-ref --format="%(INVALID)" refs/heads
162'
163
164test_expect_success 'Check format specifiers are ignored in naming date atoms' '
165 git for-each-ref --format="%(authordate)" refs/heads &&
166 git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads &&
167 git for-each-ref --format="%(authordate) %(authordate:default)" refs/heads &&
168 git for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads
169'
170
171test_expect_success 'Check valid format specifiers for date fields' '
172 git for-each-ref --format="%(authordate:default)" refs/heads &&
173 git for-each-ref --format="%(authordate:relative)" refs/heads &&
174 git for-each-ref --format="%(authordate:short)" refs/heads &&
175 git for-each-ref --format="%(authordate:local)" refs/heads &&
176 git for-each-ref --format="%(authordate:iso8601)" refs/heads &&
177 git for-each-ref --format="%(authordate:rfc2822)" refs/heads
178'
179
180test_expect_success 'Check invalid format specifiers are errors' '
181 test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads
182'
183
184test_expect_success 'arguments to %(objectname:short=) must be positive integers' '
185 test_must_fail git for-each-ref --format="%(objectname:short=0)" &&
186 test_must_fail git for-each-ref --format="%(objectname:short=-1)" &&
187 test_must_fail git for-each-ref --format="%(objectname:short=foo)"
188'
189
190test_date () {
191 f=$1 &&
192 committer_date=$2 &&
193 author_date=$3 &&
194 tagger_date=$4 &&
195 cat >expected <<-EOF &&
196 'refs/heads/master' '$committer_date' '$author_date'
197 'refs/tags/testtag' '$tagger_date'
198 EOF
199 (
200 git for-each-ref --shell \
201 --format="%(refname) %(committerdate${f:+:$f}) %(authordate${f:+:$f})" \
202 refs/heads &&
203 git for-each-ref --shell \
204 --format="%(refname) %(taggerdate${f:+:$f})" \
205 refs/tags
206 ) >actual &&
207 test_cmp expected actual
208}
209
210test_expect_success 'Check unformatted date fields output' '
211 test_date "" \
212 "Tue Jul 4 01:18:43 2006 +0200" \
213 "Tue Jul 4 01:18:44 2006 +0200" \
214 "Tue Jul 4 01:18:45 2006 +0200"
215'
216
217test_expect_success 'Check format "default" formatted date fields output' '
218 test_date default \
219 "Tue Jul 4 01:18:43 2006 +0200" \
220 "Tue Jul 4 01:18:44 2006 +0200" \
221 "Tue Jul 4 01:18:45 2006 +0200"
222'
223
224test_expect_success 'Check format "default-local" date fields output' '
225 test_date default-local "Mon Jul 3 23:18:43 2006" "Mon Jul 3 23:18:44 2006" "Mon Jul 3 23:18:45 2006"
226'
227
228# Don't know how to do relative check because I can't know when this script
229# is going to be run and can't fake the current time to git, and hence can't
230# provide expected output. Instead, I'll just make sure that "relative"
231# doesn't exit in error
232test_expect_success 'Check format "relative" date fields output' '
233 f=relative &&
234 (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&
235 git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual
236'
237
238# We just check that this is the same as "relative" for now.
239test_expect_success 'Check format "relative-local" date fields output' '
240 test_date relative-local \
241 "$(git for-each-ref --format="%(committerdate:relative)" refs/heads)" \
242 "$(git for-each-ref --format="%(authordate:relative)" refs/heads)" \
243 "$(git for-each-ref --format="%(taggerdate:relative)" refs/tags)"
244'
245
246test_expect_success 'Check format "short" date fields output' '
247 test_date short 2006-07-04 2006-07-04 2006-07-04
248'
249
250test_expect_success 'Check format "short-local" date fields output' '
251 test_date short-local 2006-07-03 2006-07-03 2006-07-03
252'
253
254test_expect_success 'Check format "local" date fields output' '
255 test_date local \
256 "Mon Jul 3 23:18:43 2006" \
257 "Mon Jul 3 23:18:44 2006" \
258 "Mon Jul 3 23:18:45 2006"
259'
260
261test_expect_success 'Check format "iso8601" date fields output' '
262 test_date iso8601 \
263 "2006-07-04 01:18:43 +0200" \
264 "2006-07-04 01:18:44 +0200" \
265 "2006-07-04 01:18:45 +0200"
266'
267
268test_expect_success 'Check format "iso8601-local" date fields output' '
269 test_date iso8601-local "2006-07-03 23:18:43 +0000" "2006-07-03 23:18:44 +0000" "2006-07-03 23:18:45 +0000"
270'
271
272test_expect_success 'Check format "rfc2822" date fields output' '
273 test_date rfc2822 \
274 "Tue, 4 Jul 2006 01:18:43 +0200" \
275 "Tue, 4 Jul 2006 01:18:44 +0200" \
276 "Tue, 4 Jul 2006 01:18:45 +0200"
277'
278
279test_expect_success 'Check format "rfc2822-local" date fields output' '
280 test_date rfc2822-local "Mon, 3 Jul 2006 23:18:43 +0000" "Mon, 3 Jul 2006 23:18:44 +0000" "Mon, 3 Jul 2006 23:18:45 +0000"
281'
282
283test_expect_success 'Check format "raw" date fields output' '
284 test_date raw "1151968723 +0200" "1151968724 +0200" "1151968725 +0200"
285'
286
287test_expect_success 'Check format "raw-local" date fields output' '
288 test_date raw-local "1151968723 +0000" "1151968724 +0000" "1151968725 +0000"
289'
290
291test_expect_success 'Check format of strftime date fields' '
292 echo "my date is 2006-07-04" >expected &&
293 git for-each-ref \
294 --format="%(authordate:format:my date is %Y-%m-%d)" \
295 refs/heads >actual &&
296 test_cmp expected actual
297'
298
299test_expect_success 'Check format of strftime-local date fields' '
300 echo "my date is 2006-07-03" >expected &&
301 git for-each-ref \
302 --format="%(authordate:format-local:my date is %Y-%m-%d)" \
303 refs/heads >actual &&
304 test_cmp expected actual
305'
306
307test_expect_success 'exercise strftime with odd fields' '
308 echo >expected &&
309 git for-each-ref --format="%(authordate:format:)" refs/heads >actual &&
310 test_cmp expected actual &&
311 long="long format -- $_z40$_z40$_z40$_z40$_z40$_z40$_z40" &&
312 echo $long >expected &&
313 git for-each-ref --format="%(authordate:format:$long)" refs/heads >actual &&
314 test_cmp expected actual
315'
316
317cat >expected <<\EOF
318refs/heads/master
319refs/remotes/origin/master
320refs/tags/testtag
321EOF
322
323test_expect_success 'Verify ascending sort' '
324 git for-each-ref --format="%(refname)" --sort=refname >actual &&
325 test_cmp expected actual
326'
327
328
329cat >expected <<\EOF
330refs/tags/testtag
331refs/remotes/origin/master
332refs/heads/master
333EOF
334
335test_expect_success 'Verify descending sort' '
336 git for-each-ref --format="%(refname)" --sort=-refname >actual &&
337 test_cmp expected actual
338'
339
340cat >expected <<\EOF
341'refs/heads/master'
342'refs/remotes/origin/master'
343'refs/tags/testtag'
344EOF
345
346test_expect_success 'Quoting style: shell' '
347 git for-each-ref --shell --format="%(refname)" >actual &&
348 test_cmp expected actual
349'
350
351test_expect_success 'Quoting style: perl' '
352 git for-each-ref --perl --format="%(refname)" >actual &&
353 test_cmp expected actual
354'
355
356test_expect_success 'Quoting style: python' '
357 git for-each-ref --python --format="%(refname)" >actual &&
358 test_cmp expected actual
359'
360
361cat >expected <<\EOF
362"refs/heads/master"
363"refs/remotes/origin/master"
364"refs/tags/testtag"
365EOF
366
367test_expect_success 'Quoting style: tcl' '
368 git for-each-ref --tcl --format="%(refname)" >actual &&
369 test_cmp expected actual
370'
371
372for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
373 test_expect_success "more than one quoting style: $i" "
374 git for-each-ref $i 2>&1 | (read line &&
375 case \$line in
376 \"error: more than one quoting style\"*) : happy;;
377 *) false
378 esac)
379 "
380done
381
382test_expect_success 'setup for upstream:track[short]' '
383 test_commit two
384'
385
386test_atom head upstream:track '[ahead 1]'
387test_atom head upstream:trackshort '>'
388test_atom head upstream:track,nobracket 'ahead 1'
389test_atom head upstream:nobracket,track 'ahead 1'
390test_atom head push:track '[ahead 1]'
391test_atom head push:trackshort '>'
392
393test_expect_success 'Check that :track[short] cannot be used with other atoms' '
394 test_must_fail git for-each-ref --format="%(refname:track)" 2>/dev/null &&
395 test_must_fail git for-each-ref --format="%(refname:trackshort)" 2>/dev/null
396'
397
398test_expect_success 'Check that :track[short] works when upstream is invalid' '
399 cat >expected <<-\EOF &&
400 [gone]
401
402 EOF
403 test_when_finished "git config branch.master.merge refs/heads/master" &&
404 git config branch.master.merge refs/heads/does-not-exist &&
405 git for-each-ref \
406 --format="%(upstream:track)$LF%(upstream:trackshort)" \
407 refs/heads >actual &&
408 test_cmp expected actual
409'
410
411test_expect_success 'Check for invalid refname format' '
412 test_must_fail git for-each-ref --format="%(refname:INVALID)"
413'
414
415cat >expected <<EOF
416$(git rev-parse --short refs/heads/master) <GREEN>master<RESET>
417$(git rev-parse --short refs/remotes/origin/master) <GREEN>origin/master<RESET>
418$(git rev-parse --short refs/tags/testtag) <GREEN>testtag<RESET>
419$(git rev-parse --short refs/tags/two) <GREEN>two<RESET>
420EOF
421
422test_expect_success 'Check %(color:...) ' '
423 git for-each-ref \
424 --format="%(objectname:short) %(color:green)%(refname:short)" \
425 >actual.raw &&
426 test_decode_color <actual.raw >actual &&
427 test_cmp expected actual
428'
429
430cat >expected <<\EOF
431heads/master
432tags/master
433EOF
434
435test_expect_success 'Check ambiguous head and tag refs (strict)' '
436 git config --bool core.warnambiguousrefs true &&
437 git checkout -b newtag &&
438 echo "Using $datestamp" > one &&
439 git add one &&
440 git commit -m "Branch" &&
441 setdate_and_increment &&
442 git tag -m "Tagging at $datestamp" master &&
443 git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
444 test_cmp expected actual
445'
446
447cat >expected <<\EOF
448heads/master
449master
450EOF
451
452test_expect_success 'Check ambiguous head and tag refs (loose)' '
453 git config --bool core.warnambiguousrefs false &&
454 git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
455 test_cmp expected actual
456'
457
458cat >expected <<\EOF
459heads/ambiguous
460ambiguous
461EOF
462
463test_expect_success 'Check ambiguous head and tag refs II (loose)' '
464 git checkout master &&
465 git tag ambiguous testtag^0 &&
466 git branch ambiguous testtag^0 &&
467 git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual &&
468 test_cmp expected actual
469'
470
471test_expect_success 'an unusual tag with an incomplete line' '
472
473 git tag -m "bogo" bogo &&
474 bogo=$(git cat-file tag bogo) &&
475 bogo=$(printf "%s" "$bogo" | git mktag) &&
476 git tag -f bogo "$bogo" &&
477 git for-each-ref --format "%(body)" refs/tags/bogo
478
479'
480
481test_expect_success 'create tag with subject and body content' '
482 cat >>msg <<-\EOF &&
483 the subject line
484
485 first body line
486 second body line
487 EOF
488 git tag -F msg subject-body
489'
490test_atom refs/tags/subject-body subject 'the subject line'
491test_atom refs/tags/subject-body body 'first body line
492second body line
493'
494test_atom refs/tags/subject-body contents 'the subject line
495
496first body line
497second body line
498'
499
500test_expect_success 'create tag with multiline subject' '
501 cat >msg <<-\EOF &&
502 first subject line
503 second subject line
504
505 first body line
506 second body line
507 EOF
508 git tag -F msg multiline
509'
510test_atom refs/tags/multiline subject 'first subject line second subject line'
511test_atom refs/tags/multiline contents:subject 'first subject line second subject line'
512test_atom refs/tags/multiline body 'first body line
513second body line
514'
515test_atom refs/tags/multiline contents:body 'first body line
516second body line
517'
518test_atom refs/tags/multiline contents:signature ''
519test_atom refs/tags/multiline contents 'first subject line
520second subject line
521
522first body line
523second body line
524'
525
526test_expect_success GPG 'create signed tags' '
527 git tag -s -m "" signed-empty &&
528 git tag -s -m "subject line" signed-short &&
529 cat >msg <<-\EOF &&
530 subject line
531
532 body contents
533 EOF
534 git tag -s -F msg signed-long
535'
536
537sig='-----BEGIN PGP SIGNATURE-----
538-----END PGP SIGNATURE-----
539'
540
541PREREQ=GPG
542test_atom refs/tags/signed-empty subject ''
543test_atom refs/tags/signed-empty contents:subject ''
544test_atom refs/tags/signed-empty body "$sig"
545test_atom refs/tags/signed-empty contents:body ''
546test_atom refs/tags/signed-empty contents:signature "$sig"
547test_atom refs/tags/signed-empty contents "$sig"
548
549test_atom refs/tags/signed-short subject 'subject line'
550test_atom refs/tags/signed-short contents:subject 'subject line'
551test_atom refs/tags/signed-short body "$sig"
552test_atom refs/tags/signed-short contents:body ''
553test_atom refs/tags/signed-short contents:signature "$sig"
554test_atom refs/tags/signed-short contents "subject line
555$sig"
556
557test_atom refs/tags/signed-long subject 'subject line'
558test_atom refs/tags/signed-long contents:subject 'subject line'
559test_atom refs/tags/signed-long body "body contents
560$sig"
561test_atom refs/tags/signed-long contents:body 'body contents
562'
563test_atom refs/tags/signed-long contents:signature "$sig"
564test_atom refs/tags/signed-long contents "subject line
565
566body contents
567$sig"
568
569cat >expected <<EOF
570$(git rev-parse refs/tags/bogo) <committer@example.com> refs/tags/bogo
571$(git rev-parse refs/tags/master) <committer@example.com> refs/tags/master
572EOF
573
574test_expect_success 'Verify sort with multiple keys' '
575 git for-each-ref --format="%(objectname) %(taggeremail) %(refname)" --sort=objectname --sort=taggeremail \
576 refs/tags/bogo refs/tags/master > actual &&
577 test_cmp expected actual
578'
579
580
581test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
582 test_when_finished "git checkout master" &&
583 git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
584 sed -e "s/^\* / /" actual >expect &&
585 git checkout --orphan orphaned-branch &&
586 git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
587 test_cmp expect actual
588'
589
590cat >trailers <<EOF
591Reviewed-by: A U Thor <author@example.com>
592Signed-off-by: A U Thor <author@example.com>
593EOF
594
595test_expect_success 'basic atom: head contents:trailers' '
596 echo "Some contents" > two &&
597 git add two &&
598 git commit -F - <<-EOF &&
599 trailers: this commit message has trailers
600
601 Some message contents
602
603 $(cat trailers)
604 EOF
605 git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
606 sanitize_pgp <actual >actual.clean &&
607 # git for-each-ref ends with a blank line
608 cat >expect <<-EOF &&
609 $(cat trailers)
610
611 EOF
612 test_cmp expect actual.clean
613'
614
615test_expect_success 'Add symbolic ref for the following tests' '
616 git symbolic-ref refs/heads/sym refs/heads/master
617'
618
619cat >expected <<EOF
620refs/heads/master
621EOF
622
623test_expect_success 'Verify usage of %(symref) atom' '
624 git for-each-ref --format="%(symref)" refs/heads/sym >actual &&
625 test_cmp expected actual
626'
627
628cat >expected <<EOF
629heads/master
630EOF
631
632test_expect_success 'Verify usage of %(symref:short) atom' '
633 git for-each-ref --format="%(symref:short)" refs/heads/sym >actual &&
634 test_cmp expected actual
635'
636
637cat >expected <<EOF
638master
639heads/master
640EOF
641
642test_expect_success 'Verify usage of %(symref:lstrip) atom' '
643 git for-each-ref --format="%(symref:lstrip=2)" refs/heads/sym > actual &&
644 git for-each-ref --format="%(symref:lstrip=-2)" refs/heads/sym >> actual &&
645 test_cmp expected actual &&
646
647 git for-each-ref --format="%(symref:strip=2)" refs/heads/sym > actual &&
648 git for-each-ref --format="%(symref:strip=-2)" refs/heads/sym >> actual &&
649 test_cmp expected actual
650'
651
652cat >expected <<EOF
653refs
654refs/heads
655EOF
656
657test_expect_success 'Verify usage of %(symref:rstrip) atom' '
658 git for-each-ref --format="%(symref:rstrip=2)" refs/heads/sym > actual &&
659 git for-each-ref --format="%(symref:rstrip=-2)" refs/heads/sym >> actual &&
660 test_cmp expected actual
661'
662
663test_done