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