(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'for-each-ref test'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/lib-gpg.sh)})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:datestamp) op:Equal rhs:{(1151968723)} spids:[34])]
      spids: [34]
    )
    (FuncDef
      name: setdate_and_increment
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:GIT_COMMITTER_DATE)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name '$datestamp') (' +0200'))}
                  spids: [45]
                )
              ]
              spids: [45]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:datestamp)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(expr)} {(DQ ($ VSub_Name '$datestamp'))} {(Lit_Other '+')} {(1)})
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [53 63]
                      )
                    }
                  spids: [52]
                )
              ]
              spids: [52]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:GIT_AUTHOR_DATE)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name '$datestamp') (' +0200'))}
                  spids: [66]
                )
              ]
              spids: [66]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:datestamp)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(expr)} {(DQ ($ VSub_Name '$datestamp'))} {(Lit_Other '+')} {(1)})
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [74 84]
                      )
                    }
                  spids: [73]
                )
              ]
              spids: [73]
            )
            (C {(export)} {(GIT_COMMITTER_DATE)} {(GIT_AUTHOR_DATE)})
          ]
          spids: [42]
        )
      spids: [37 41]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <'\n'> <'\tsetdate_and_increment &&\n'> <'\techo "Using $datestamp" > one &&\n'> 
          <'\tgit add one &&\n'> <'\tgit commit -m "Initial" &&\n'> <'\tsetdate_and_increment &&\n'> 
          <'\tgit tag -a -m "Tagging at $datestamp" testtag &&\n'> <'\tgit update-ref refs/remotes/origin/master master &&\n'> <'\tgit remote add origin nowhere &&\n'> 
          <'\tgit config branch.master.remote origin &&\n'> <'\tgit config branch.master.merge refs/heads/master &&\n'> <'\tgit remote add myfork elsewhere &&\n'> 
          <'\tgit config remote.pushdefault myfork &&\n'> <'\tgit config push.default current\n'>
        )
      }
    )
    (FuncDef
      name: test_atom
      body: 
        (BraceGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Number '$1'))}
              arms: [
                (case_arm
                  pat_list: [{(head)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:ref)
                          op: Equal
                          rhs: {(refs/heads/master)}
                          spids: [137]
                        )
                      ]
                      spids: [137]
                    )
                  ]
                  spids: [134 135 140 16777215]
                )
                (case_arm
                  pat_list: [{(tag)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:ref)
                          op: Equal
                          rhs: {(refs/tags/testtag)}
                          spids: [146]
                        )
                      ]
                      spids: [146]
                    )
                  ]
                  spids: [143 144 149 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:ref)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                          spids: [155]
                        )
                      ]
                      spids: [155]
                    )
                  ]
                  spids: [152 153 158 16777215]
                )
              ]
              spids: [125 131 161]
            )
            (SimpleCommand
              words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_Number '$3'))}]
              redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[174])]
            )
            (C 
              {(test_expect_) 
                (BracedVarSub
                  token: <VSub_Number 4>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(success)})
                  spids: [179 183]
                )
              } {($ VSub_Name '$PREREQ')} {(DQ ('basic atom: ') ($ VSub_Number '$1') (' ') ($ VSub_Number '$2'))} 
              {
                (DQ ('\n') ("\t\tgit for-each-ref --format='%(") ($ VSub_Number '$2') (")' ") 
                  ($ VSub_Name '$ref') (' >actual &&\n') ('\t\tsanitize_pgp <actual >actual.clean &&\n') 
                  ('\t\ttest_cmp expected actual.clean\n') ('\t')
                )
              }
            )
          ]
          spids: [122]
        )
      spids: [118 121]
    )
    (C {(test_atom)} {(head)} {(refname)} {(refs/heads/master)})
    (C {(test_atom)} {(head)} {(refname) (Lit_Other ':') (short)} {(master)})
    (C {(test_atom)} {(head)} {(refname) (Lit_Other ':') (Lit_VarLike 'strip=') (1)} {(heads/master)})
    (C {(test_atom)} {(head)} {(refname) (Lit_Other ':') (Lit_VarLike 'strip=') (2)} {(master)})
    (C {(test_atom)} {(head)} {(upstream)} {(refs/remotes/origin/master)})
    (C {(test_atom)} {(head)} {(upstream) (Lit_Other ':') (short)} {(origin/master)})
    (C {(test_atom)} {(head)} {(push)} {(refs/remotes/myfork/master)})
    (C {(test_atom)} {(head)} {(push) (Lit_Other ':') (short)} {(myfork/master)})
    (C {(test_atom)} {(head)} {(objecttype)} {(commit)})
    (C {(test_atom)} {(head)} {(objectsize)} {(171)})
    (C {(test_atom)} {(head)} {(objectname)} 
      {
        (CommandSubPart
          command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(refs/heads/master)})])
          left_token: <Left_CommandSub '$('>
          spids: [307 313]
        )
      }
    )
    (C {(test_atom)} {(head)} {(objectname) (Lit_Other ':') (short)} 
      {
        (CommandSubPart
          command_list: 
            (CommandList
              children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/heads/master)})]
            )
          left_token: <Left_CommandSub '$('>
          spids: [323 331]
        )
      }
    )
    (C {(test_atom)} {(head)} {(tree)} 
      {
        (CommandSubPart
          command_list: 
            (CommandList
              children: [
                (C {(git)} {(rev-parse)} 
                  {(refs/heads/master) (Lit_Other '^') (Lit_LBrace '{') (tree) (Lit_RBrace '}')}
                )
              ]
            )
          left_token: <Left_CommandSub '$('>
          spids: [339 349]
        )
      }
    )
    (C {(test_atom)} {(head)} {(parent)} {(SQ )})
    (C {(test_atom)} {(head)} {(numparent)} {(0)})
    (C {(test_atom)} {(head)} {(object)} {(SQ )})
    (C {(test_atom)} {(head)} {(type)} {(SQ )})
    (C {(test_atom)} {(head)} {(SQ <'*objectname'>)} {(SQ )})
    (C {(test_atom)} {(head)} {(SQ <'*objecttype'>)} {(SQ )})
    (C {(test_atom)} {(head)} {(author)} {(SQ <'A U Thor <author@example.com> 1151968724 +0200'>)})
    (C {(test_atom)} {(head)} {(authorname)} {(SQ <'A U Thor'>)})
    (C {(test_atom)} {(head)} {(authoremail)} {(SQ <'<author@example.com>'>)})
    (C {(test_atom)} {(head)} {(authordate)} {(SQ <'Tue Jul 4 01:18:44 2006 +0200'>)})
    (C {(test_atom)} {(head)} {(committer)} {(SQ <'C O Mitter <committer@example.com> 1151968723 +0200'>)})
    (C {(test_atom)} {(head)} {(committername)} {(SQ <'C O Mitter'>)})
    (C {(test_atom)} {(head)} {(committeremail)} {(SQ <'<committer@example.com>'>)})
    (C {(test_atom)} {(head)} {(committerdate)} {(SQ <'Tue Jul 4 01:18:43 2006 +0200'>)})
    (C {(test_atom)} {(head)} {(tag)} {(SQ )})
    (C {(test_atom)} {(head)} {(tagger)} {(SQ )})
    (C {(test_atom)} {(head)} {(taggername)} {(SQ )})
    (C {(test_atom)} {(head)} {(taggeremail)} {(SQ )})
    (C {(test_atom)} {(head)} {(taggerdate)} {(SQ )})
    (C {(test_atom)} {(head)} {(creator)} {(SQ <'C O Mitter <committer@example.com> 1151968723 +0200'>)})
    (C {(test_atom)} {(head)} {(creatordate)} {(SQ <'Tue Jul 4 01:18:43 2006 +0200'>)})
    (C {(test_atom)} {(head)} {(subject)} {(SQ <Initial>)})
    (C {(test_atom)} {(head)} {(contents) (Lit_Other ':') (subject)} {(SQ <Initial>)})
    (C {(test_atom)} {(head)} {(body)} {(SQ )})
    (C {(test_atom)} {(head)} {(contents) (Lit_Other ':') (body)} {(SQ )})
    (C {(test_atom)} {(head)} {(contents) (Lit_Other ':') (signature)} {(SQ )})
    (C {(test_atom)} {(head)} {(contents)} {(SQ <'Initial\n'>)})
    (C {(test_atom)} {(head)} {(HEAD)} {(SQ <'*'>)})
    (C {(test_atom)} {(tag)} {(refname)} {(refs/tags/testtag)})
    (C {(test_atom)} {(tag)} {(refname) (Lit_Other ':') (short)} {(testtag)})
    (C {(test_atom)} {(tag)} {(upstream)} {(SQ )})
    (C {(test_atom)} {(tag)} {(push)} {(SQ )})
    (C {(test_atom)} {(tag)} {(objecttype)} {(tag)})
    (C {(test_atom)} {(tag)} {(objectsize)} {(154)})
    (C {(test_atom)} {(tag)} {(objectname)} 
      {
        (CommandSubPart
          command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(refs/tags/testtag)})])
          left_token: <Left_CommandSub '$('>
          spids: [685 691]
        )
      }
    )
    (C {(test_atom)} {(tag)} {(objectname) (Lit_Other ':') (short)} 
      {
        (CommandSubPart
          command_list: 
            (CommandList
              children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/tags/testtag)})]
            )
          left_token: <Left_CommandSub '$('>
          spids: [701 709]
        )
      }
    )
    (C {(test_atom)} {(tag)} {(tree)} {(SQ )})
    (C {(test_atom)} {(tag)} {(parent)} {(SQ )})
    (C {(test_atom)} {(tag)} {(numparent)} {(SQ )})
    (C {(test_atom)} {(tag)} {(object)} 
      {
        (CommandSubPart
          command_list: 
            (CommandList
              children: [(C {(git)} {(rev-parse)} {(refs/tags/testtag) (Lit_Other '^') (0)})]
            )
          left_token: <Left_CommandSub '$('>
          spids: [744 752]
        )
      }
    )
    (C {(test_atom)} {(tag)} {(type)} {(SQ <commit>)})
    (C {(test_atom)} {(tag)} {(SQ <'*objectname'>)} {(SQ <ea122842f48be4afb2d1fc6a4b96c05885ab7463>)})
    (C {(test_atom)} {(tag)} {(SQ <'*objecttype'>)} {(SQ <commit>)})
    (C {(test_atom)} {(tag)} {(author)} {(SQ )})
    (C {(test_atom)} {(tag)} {(authorname)} {(SQ )})
    (C {(test_atom)} {(tag)} {(authoremail)} {(SQ )})
    (C {(test_atom)} {(tag)} {(authordate)} {(SQ )})
    (C {(test_atom)} {(tag)} {(committer)} {(SQ )})
    (C {(test_atom)} {(tag)} {(committername)} {(SQ )})
    (C {(test_atom)} {(tag)} {(committeremail)} {(SQ )})
    (C {(test_atom)} {(tag)} {(committerdate)} {(SQ )})
    (C {(test_atom)} {(tag)} {(tag)} {(SQ <testtag>)})
    (C {(test_atom)} {(tag)} {(tagger)} {(SQ <'C O Mitter <committer@example.com> 1151968725 +0200'>)})
    (C {(test_atom)} {(tag)} {(taggername)} {(SQ <'C O Mitter'>)})
    (C {(test_atom)} {(tag)} {(taggeremail)} {(SQ <'<committer@example.com>'>)})
    (C {(test_atom)} {(tag)} {(taggerdate)} {(SQ <'Tue Jul 4 01:18:45 2006 +0200'>)})
    (C {(test_atom)} {(tag)} {(creator)} {(SQ <'C O Mitter <committer@example.com> 1151968725 +0200'>)})
    (C {(test_atom)} {(tag)} {(creatordate)} {(SQ <'Tue Jul 4 01:18:45 2006 +0200'>)})
    (C {(test_atom)} {(tag)} {(subject)} {(SQ <'Tagging at 1151968727'>)})
    (C {(test_atom)} {(tag)} {(contents) (Lit_Other ':') (subject)} {(SQ <'Tagging at 1151968727'>)})
    (C {(test_atom)} {(tag)} {(body)} {(SQ )})
    (C {(test_atom)} {(tag)} {(contents) (Lit_Other ':') (body)} {(SQ )})
    (C {(test_atom)} {(tag)} {(contents) (Lit_Other ':') (signature)} {(SQ )})
    (C {(test_atom)} {(tag)} {(contents)} {(SQ <'Tagging at 1151968727\n'>)})
    (C {(test_atom)} {(tag)} {(HEAD)} {(SQ <' '>)})
    (C {(test_expect_success)} {(SQ <'Check invalid atoms names are errors'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(INVALID)" refs/heads\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'arguments to :strip must be positive integers'>)} 
      {
        (SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(refname:strip=0)" &&\n'> 
          <'\ttest_must_fail git for-each-ref --format="%(refname:strip=-1)" &&\n'> <'\ttest_must_fail git for-each-ref --format="%(refname:strip=foo)"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'stripping refnames too far gives an error'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(refname:strip=3)"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'Check format specifiers are ignored in naming date atoms'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --format="%(authordate)" refs/heads &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:default) %(authordate)" refs/heads &&\n'> <'\tgit for-each-ref --format="%(authordate) %(authordate:default)" refs/heads &&\n'> 
          <
'\tgit for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads\n'
          >
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check valid format specifiers for date fields'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --format="%(authordate:default)" refs/heads &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:relative)" refs/heads &&\n'> <'\tgit for-each-ref --format="%(authordate:short)" refs/heads &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:local)" refs/heads &&\n'> <'\tgit for-each-ref --format="%(authordate:iso8601)" refs/heads &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:rfc2822)" refs/heads\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check invalid format specifiers are errors'>)} 
      {
        (SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads\n'>)
      }
    )
    (FuncDef
      name: test_date
      body: 
        (BraceGroup
          children: [
            (AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:f)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [1094]
                    )
                  ]
                  spids: [1094]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:committer_date)
                      op: Equal
                      rhs: {($ VSub_Number '$2')}
                      spids: [1100]
                    )
                  ]
                  spids: [1100]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:author_date)
                      op: Equal
                      rhs: {($ VSub_Number '$3')}
                      spids: [1106]
                    )
                  ]
                  spids: [1106]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:tagger_date)
                      op: Equal
                      rhs: {($ VSub_Number '$4')}
                      spids: [1112]
                    )
                  ]
                  spids: [1112]
                )
                (SimpleCommand
                  words: [{(cat)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: 16777215
                      arg_word: {(expected)}
                      spids: [1120]
                    )
                    (HereDoc
                      op_id: Redir_DLessDash
                      fd: 16777215
                      body: 
                        {
                          (DQ ("'refs/heads/master' '") ($ VSub_Name '$committer_date') ("' '") 
                            ($ VSub_Name '$author_date') ("'\n") ("'refs/tags/testtag' '") ($ VSub_Name '$tagger_date') ("'\n")
                          )
                        }
                      do_expansion: True
                      here_end: EOF
                      was_filled: T
                      spids: [1123]
                    )
                  ]
                )
                (Subshell
                  child: 
                    (AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(git)} {(for-each-ref)} {(--shell)} 
                          {(--format) (Lit_Other '=') 
                            (DQ ('%(refname) %(committerdate') 
                              (BracedVarSub
                                token: <VSub_Name f>
                                suffix_op: 
                                  (StringUnary
                                    op_id: VTest_ColonPlus
                                    arg_word: {(':') ($ VSub_Name '$f')}
                                  )
                                spids: [1153 1158]
                              ) (') %(authordate') 
                              (BracedVarSub
                                token: <VSub_Name f>
                                suffix_op: 
                                  (StringUnary
                                    op_id: VTest_ColonPlus
                                    arg_word: {(':') ($ VSub_Name '$f')}
                                  )
                                spids: [1160 1165]
                              ) (')')
                            )
                          } {(refs/heads)}
                        )
                        (C {(git)} {(for-each-ref)} {(--shell)} 
                          {(--format) (Lit_Other '=') 
                            (DQ ('%(refname) %(taggerdate') 
                              (BracedVarSub
                                token: <VSub_Name f>
                                suffix_op: 
                                  (StringUnary
                                    op_id: VTest_ColonPlus
                                    arg_word: {(':') ($ VSub_Name '$f')}
                                  )
                                spids: [1188 1193]
                              ) (')')
                            )
                          } {(refs/tags)}
                        )
                      ]
                    )
                  redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(actual)} spids:[1204])]
                  spids: [1138 1202]
                )
                (C {(test_cmp)} {(expected)} {(actual)})
              ]
            )
          ]
          spids: [1091]
        )
      spids: [1086 1090]
    )
    (C {(test_expect_success)} {(SQ <'Check unformatted date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date "" \\\n'> <'\t\t"Tue Jul 4 01:18:43 2006 +0200" \\\n'> 
          <'\t\t"Tue Jul 4 01:18:44 2006 +0200" \\\n'> <'\t\t"Tue Jul 4 01:18:45 2006 +0200"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "default" formatted date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date default \\\n'> <'\t\t"Tue Jul 4 01:18:43 2006 +0200" \\\n'> 
          <'\t\t"Tue Jul 4 01:18:44 2006 +0200" \\\n'> <'\t\t"Tue Jul 4 01:18:45 2006 +0200"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "default-local" date fields output'>)} 
      {
        (SQ <'\n'> 
          <
'\ttest_date default-local "Mon Jul 3 23:18:43 2006" "Mon Jul 3 23:18:44 2006" "Mon Jul 3 23:18:45 2006"\n'
          >
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "relative" date fields output'>)} 
      {
        (SQ <'\n'> <'\tf=relative &&\n'> 
          <
'\t(git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads &&\n'
          > <'\tgit for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "relative-local" date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date relative-local \\\n'> 
          <'\t\t"$(git for-each-ref --format="%(committerdate:relative)" refs/heads)" \\\n'> <'\t\t"$(git for-each-ref --format="%(authordate:relative)" refs/heads)" \\\n'> 
          <'\t\t"$(git for-each-ref --format="%(taggerdate:relative)" refs/tags)"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "short" date fields output'>)} 
      {(SQ <'\n'> <'\ttest_date short 2006-07-04 2006-07-04 2006-07-04\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'Check format "short-local" date fields output'>)} 
      {(SQ <'\n'> <'\ttest_date short-local 2006-07-03 2006-07-03 2006-07-03\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'Check format "local" date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date local \\\n'> <'\t\t"Mon Jul 3 23:18:43 2006" \\\n'> 
          <'\t\t"Mon Jul 3 23:18:44 2006" \\\n'> <'\t\t"Mon Jul 3 23:18:45 2006"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "iso8601" date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date iso8601 \\\n'> <'\t\t"2006-07-04 01:18:43 +0200" \\\n'> 
          <'\t\t"2006-07-04 01:18:44 +0200" \\\n'> <'\t\t"2006-07-04 01:18:45 +0200"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "iso8601-local" date fields output'>)} 
      {
        (SQ <'\n'> 
          <
'\ttest_date iso8601-local "2006-07-03 23:18:43 +0000" "2006-07-03 23:18:44 +0000" "2006-07-03 23:18:45 +0000"\n'
          >
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "rfc2822" date fields output'>)} 
      {
        (SQ <'\n'> <'\ttest_date rfc2822 \\\n'> <'\t\t"Tue, 4 Jul 2006 01:18:43 +0200" \\\n'> 
          <'\t\t"Tue, 4 Jul 2006 01:18:44 +0200" \\\n'> <'\t\t"Tue, 4 Jul 2006 01:18:45 +0200"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "rfc2822-local" date fields output'>)} 
      {
        (SQ <'\n'> 
          <
'\ttest_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"\n'
          >
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format "raw" date fields output'>)} 
      {(SQ <'\n'> <'\ttest_date raw "1151968723 +0200" "1151968724 +0200" "1151968725 +0200"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'Check format "raw-local" date fields output'>)} 
      {
        (SQ <'\n'> 
          <'\ttest_date raw-local "1151968723 +0000" "1151968724 +0000" "1151968725 +0000"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format of strftime date fields'>)} 
      {
        (SQ <'\n'> <'\techo "my date is 2006-07-04" >expected &&\n'> <'\tgit for-each-ref \\\n'> 
          <'\t  --format="%(authordate:format:my date is %Y-%m-%d)" \\\n'> <'\t  refs/heads >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check format of strftime-local date fields'>)} 
      {
        (SQ <'\n'> <'\techo "my date is 2006-07-03" >expected &&\n'> <'\tgit for-each-ref \\\n'> 
          <'\t  --format="%(authordate:format-local:my date is %Y-%m-%d)" \\\n'> <'\t  refs/heads >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'exercise strftime with odd fields'>)} 
      {
        (SQ <'\n'> <'\techo >expected &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:format:)" refs/heads >actual &&\n'> <'\ttest_cmp expected actual &&\n'> 
          <'\tlong="long format -- $_z40$_z40$_z40$_z40$_z40$_z40$_z40" &&\n'> <'\techo $long >expected &&\n'> 
          <'\tgit for-each-ref --format="%(authordate:format:$long)" refs/heads >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1474])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('refs/heads/master\n') ('refs/remotes/origin/master\n') ('refs/tags/testtag\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1477]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Verify ascending sort'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --format="%(refname)" --sort=refname >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1498])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('refs/tags/testtag\n') ('refs/remotes/origin/master\n') ('refs/heads/master\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1501]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Verify descending sort'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --format="%(refname)" --sort=-refname >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1521])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {("'refs/heads/master'\n") ("'refs/remotes/origin/master'\n") ("'refs/tags/testtag'\n")}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1524]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Quoting style: shell'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --shell --format="%(refname)" >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Quoting style: perl'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --perl --format="%(refname)" >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Quoting style: python'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --python --format="%(refname)" >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1570])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('"refs/heads/master"\n') ('"refs/remotes/origin/master"\n') ('"refs/tags/testtag"\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1573]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Quoting style: tcl'>)} 
      {
        (SQ <'\n'> <'\tgit for-each-ref --tcl --format="%(refname)" >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (ForEach
      iter_name: i
      iter_words: [
        {(DQ ('--perl --shell'))}
        {(DQ ('-s --python'))}
        {(DQ ('--python --tcl'))}
        {(DQ ('--tcl --perl'))}
      ]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('more than one quoting style: ') ($ VSub_Name '$i'))} 
              {
                (DQ ('\n') ('\t\tgit for-each-ref ') ($ VSub_Name '$i') (' 2>&1 | (read line &&\n') 
                  ('\t\tcase ') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('line in\n') ('\t\t') 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('error: more than one quoting style') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                  ('*) : happy;;\n') ('\t\t*) false\n') ('\t\tesac)\n') ('\t')
                )
              }
            )
          ]
          spids: [1614 1642]
        )
      spids: [1596 1612]
    )
    (C {(test_expect_success)} {(SQ <'setup for upstream:track[short]'>)} 
      {(SQ <'\n'> <'\ttest_commit two\n'>)}
    )
    (C {(test_atom)} {(head)} {(upstream) (Lit_Other ':') (track)} {(SQ <'[ahead 1]'>)})
    (C {(test_atom)} {(head)} {(upstream) (Lit_Other ':') (trackshort)} {(SQ <'>'>)})
    (C {(test_atom)} {(head)} {(push) (Lit_Other ':') (track)} {(SQ <'[ahead 1]'>)})
    (C {(test_atom)} {(head)} {(push) (Lit_Other ':') (trackshort)} {(SQ <'>'>)})
    (C {(test_expect_success)} {(SQ <'Check that :track[short] cannot be used with other atoms'>)} 
      {
        (SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(refname:track)" 2>/dev/null &&\n'> 
          <'\ttest_must_fail git for-each-ref --format="%(refname:trackshort)" 2>/dev/null\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check that :track[short] works when upstream is invalid'>)} 
      {
        (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\n'> <'\n'> <'\tEOF\n'> 
          <'\ttest_when_finished "git config branch.master.merge refs/heads/master" &&\n'> <'\tgit config branch.master.merge refs/heads/does-not-exist &&\n'> <'\tgit for-each-ref \\\n'> 
          <'\t\t--format="%(upstream:track)$LF%(upstream:trackshort)" \\\n'> <'\t\trefs/heads >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Check for invalid refname format'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git for-each-ref --format="%(refname:INVALID)"\n'>)}
    )
    (FuncDef
      name: get_color
      body: 
        (BraceGroup
          children: [(C {(git)} {(config)} {(--get-color)} {(no.such.slot)} {(DQ ($ VSub_Number '$1'))})]
          spids: [1757]
        )
      spids: [1752 1756]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1777])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/heads/master)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [1783 1791]
                ) (' ') 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(green)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1793 1797]
                ) (master) 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(reset)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1799 1803]
                ) ('\n') 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/remotes/origin/master)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [1805 1813]
                ) (' ') 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(green)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1815 1819]
                ) (origin/master) 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(reset)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1821 1825]
                ) ('\n') 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/tags/testtag)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [1827 1835]
                ) (' ') 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(green)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1837 1841]
                ) (testtag) 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(reset)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1843 1847]
                ) ('\n') 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(git)} {(rev-parse)} {(--short)} {(refs/tags/two)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [1849 1857]
                ) (' ') 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(green)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1859 1863]
                ) (two) 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(get_color)} {(reset)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [1865 1869]
                ) ('\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [1780]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Check %(color:...) '>)} 
      {
        (SQ <'\n'> 
          <
'\tgit for-each-ref --format="%(objectname:short) %(color:green)%(refname:short)" >actual &&\n'
          > <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1888])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('heads/master\n') ('tags/master\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1891]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Check ambiguous head and tag refs (strict)'>)} 
      {
        (SQ <'\n'> <'\tgit config --bool core.warnambiguousrefs true &&\n'> 
          <'\tgit checkout -b newtag &&\n'> <'\techo "Using $datestamp" > one &&\n'> <'\tgit add one &&\n'> <'\tgit commit -m "Branch" &&\n'> 
          <'\tsetdate_and_increment &&\n'> <'\tgit tag -m "Tagging at $datestamp" master &&\n'> 
          <
'\tgit for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&\n'
          > <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1918])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('heads/master\n') ('master\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1921]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Check ambiguous head and tag refs (loose)'>)} 
      {
        (SQ <'\n'> <'\tgit config --bool core.warnambiguousrefs false &&\n'> 
          <
'\tgit for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&\n'
          > <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1942])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('heads/ambiguous\n') ('ambiguous\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [1945]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Check ambiguous head and tag refs II (loose)'>)} 
      {
        (SQ <'\n'> <'\tgit checkout master &&\n'> <'\tgit tag ambiguous testtag^0 &&\n'> 
          <'\tgit branch ambiguous testtag^0 &&\n'> 
          <
'\tgit for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual &&\n'
          > <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'an unusual tag with an incomplete line'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit tag -m "bogo" bogo &&\n'> <'\tbogo=$(git cat-file tag bogo) &&\n'> 
          <'\tbogo=$(printf "%s" "$bogo" | git mktag) &&\n'> <'\tgit tag -f bogo "$bogo" &&\n'> <'\tgit for-each-ref --format "%(body)" refs/tags/bogo\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'create tag with subject and body content'>)} 
      {
        (SQ <'\n'> <'\tcat >>msg <<-\\EOF &&\n'> <'\t\tthe subject line\n'> <'\n'> 
          <'\t\tfirst body line\n'> <'\t\tsecond body line\n'> <'\tEOF\n'> <'\tgit tag -F msg subject-body\n'>
        )
      }
    )
    (C {(test_atom)} {(refs/tags/subject-body)} {(subject)} {(SQ <'the subject line'>)})
    (C {(test_atom)} {(refs/tags/subject-body)} {(body)} 
      {(SQ <'first body line\n'> <'second body line\n'>)}
    )
    (C {(test_atom)} {(refs/tags/subject-body)} {(contents)} 
      {(SQ <'the subject line\n'> <'\n'> <'first body line\n'> <'second body line\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'create tag with multiline subject'>)} 
      {
        (SQ <'\n'> <'\tcat >msg <<-\\EOF &&\n'> <'\t\tfirst subject line\n'> 
          <'\t\tsecond subject line\n'> <'\n'> <'\t\tfirst body line\n'> <'\t\tsecond body line\n'> <'\tEOF\n'> <'\tgit tag -F msg multiline\n'>
        )
      }
    )
    (C {(test_atom)} {(refs/tags/multiline)} {(subject)} {(SQ <'first subject line second subject line'>)})
    (C {(test_atom)} {(refs/tags/multiline)} {(contents) (Lit_Other ':') (subject)} 
      {(SQ <'first subject line second subject line'>)}
    )
    (C {(test_atom)} {(refs/tags/multiline)} {(body)} {(SQ <'first body line\n'> <'second body line\n'>)})
    (C {(test_atom)} {(refs/tags/multiline)} {(contents) (Lit_Other ':') (body)} 
      {(SQ <'first body line\n'> <'second body line\n'>)}
    )
    (C {(test_atom)} {(refs/tags/multiline)} {(contents) (Lit_Other ':') (signature)} {(SQ )})
    (C {(test_atom)} {(refs/tags/multiline)} {(contents)} 
      {
        (SQ <'first subject line\n'> <'second subject line\n'> <'\n'> <'first body line\n'> 
          <'second body line\n'>
        )
      }
    )
    (C {(test_expect_success)} {(GPG)} {(SQ <'create signed tags'>)} 
      {
        (SQ <'\n'> <'\tgit tag -s -m "" signed-empty &&\n'> 
          <'\tgit tag -s -m "subject line" signed-short &&\n'> <'\tcat >msg <<-\\EOF &&\n'> <'\tsubject line\n'> <'\n'> <'\tbody contents\n'> <'\tEOF\n'> 
          <'\tgit tag -s -F msg signed-long\n'>
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sig)
          op: Equal
          rhs: {(SQ <'-----BEGIN PGP SIGNATURE-----\n'> <'-----END PGP SIGNATURE-----\n'>)}
          spids: [2147]
        )
      ]
      spids: [2147]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:PREREQ) op:Equal rhs:{(GPG)} spids:[2154])]
      spids: [2154]
    )
    (C {(test_atom)} {(refs/tags/signed-empty)} {(subject)} {(SQ )})
    (C {(test_atom)} {(refs/tags/signed-empty)} {(contents) (Lit_Other ':') (subject)} {(SQ )})
    (C {(test_atom)} {(refs/tags/signed-empty)} {(body)} {(DQ ($ VSub_Name '$sig'))})
    (C {(test_atom)} {(refs/tags/signed-empty)} {(contents) (Lit_Other ':') (body)} {(SQ )})
    (C {(test_atom)} {(refs/tags/signed-empty)} {(contents) (Lit_Other ':') (signature)} 
      {(DQ ($ VSub_Name '$sig'))}
    )
    (C {(test_atom)} {(refs/tags/signed-empty)} {(contents)} {(DQ ($ VSub_Name '$sig'))})
    (C {(test_atom)} {(refs/tags/signed-short)} {(subject)} {(SQ <'subject line'>)})
    (C {(test_atom)} {(refs/tags/signed-short)} {(contents) (Lit_Other ':') (subject)} 
      {(SQ <'subject line'>)}
    )
    (C {(test_atom)} {(refs/tags/signed-short)} {(body)} {(DQ ($ VSub_Name '$sig'))})
    (C {(test_atom)} {(refs/tags/signed-short)} {(contents) (Lit_Other ':') (body)} {(SQ )})
    (C {(test_atom)} {(refs/tags/signed-short)} {(contents) (Lit_Other ':') (signature)} 
      {(DQ ($ VSub_Name '$sig'))}
    )
    (C {(test_atom)} {(refs/tags/signed-short)} {(contents)} 
      {(DQ ('subject line\n') ($ VSub_Name '$sig'))}
    )
    (C {(test_atom)} {(refs/tags/signed-long)} {(subject)} {(SQ <'subject line'>)})
    (C {(test_atom)} {(refs/tags/signed-long)} {(contents) (Lit_Other ':') (subject)} 
      {(SQ <'subject line'>)}
    )
    (C {(test_atom)} {(refs/tags/signed-long)} {(body)} {(DQ ('body contents\n') ($ VSub_Name '$sig'))})
    (C {(test_atom)} {(refs/tags/signed-long)} {(contents) (Lit_Other ':') (body)} 
      {(SQ <'body contents\n'>)}
    )
    (C {(test_atom)} {(refs/tags/signed-long)} {(contents) (Lit_Other ':') (signature)} 
      {(DQ ($ VSub_Name '$sig'))}
    )
    (C {(test_atom)} {(refs/tags/signed-long)} {(contents)} 
      {(DQ ('subject line\n') ('\n') ('body contents\n') ($ VSub_Name '$sig'))}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[2361])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(refs/tags/bogo)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [2367 2373]
                ) (' <committer@example.com> refs/tags/bogo\n') 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(git)} {(rev-parse)} {(refs/tags/master)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [2375 2381]
                ) (' <committer@example.com> refs/tags/master\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [2364]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'Verify sort with multiple keys'>)} 
      {
        (SQ <'\n'> 
          <
'\tgit for-each-ref --format="%(objectname) %(taggeremail) %(refname)" --sort=objectname --sort=taggeremail \\\n'
          > <'\t\trefs/tags/bogo refs/tags/master > actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)