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