(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ 
                (Token
                  id: Id.Lit_Chars
                  val: 'tests for the peel_ref optimization of packed-refs'
                  span_id: 6
                )
              )
            }
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'create annotated tag in refs/tags' span_id:17))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:21) 
          (Token id:Id.Lit_Chars val:'\ttest_commit base &&\n' span_id:22) (Token id:Id.Lit_Chars val:'\tgit tag -m annotated foo\n' span_id:23)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'create annotated tag outside of refs/tags' span_id:30))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:34) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit update-ref refs/outside/foo refs/tags/foo\n'
            span_id: 35
          )
        )
      }
    )
    (command.ShFunction
      name: print_ref
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} 
              {
                (DQ 
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:52)
                    command_list: 
                      (command.CommandList
                        children: [(C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_Number '$1'))})]
                      )
                  ) (' ') ($ Id.VSub_Number '$1')
                )
              }
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'set up expected show-ref output' span_id:71))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:75) (Token id:Id.Lit_Chars val:'\t{\n' span_id:76) 
          (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/heads/master" &&\n' span_id:77) (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/outside/foo" &&\n' span_id:78) 
          (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/outside/foo^{}" &&\n' span_id:79) (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/tags/base" &&\n' span_id:80) 
          (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/tags/foo" &&\n' span_id:81) (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/tags/foo^{}"\n' span_id:82) 
          (Token id:Id.Lit_Chars val:'\t} >expect\n' span_id:83)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'refs are peeled outside of refs/tags (loose)' span_id:90))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:94) 
          (Token id:Id.Lit_Chars val:'\tgit show-ref -d >actual &&\n' span_id:95) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:96)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'refs are peeled outside of refs/tags (packed)' span_id:103))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:107) 
          (Token id:Id.Lit_Chars val:'\tgit pack-refs --all &&\n' span_id:108) (Token id:Id.Lit_Chars val:'\tgit show-ref -d >actual &&\n' span_id:109) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:110)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'create old-style pack-refs without fully-peeled' span_id:117))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:121) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Git no longer writes without fully-peeled, so we just write our own\n'
            span_id: 122
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t# from scratch; we could also munge the existing file to remove the\n'
            span_id: 123
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t# fully-peeled bits, but that seems even more prone to failure,\n'
            span_id: 124
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t# especially if the format ever changes again. At least this way we\n'
            span_id: 125
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t# know we are emulating exactly what an older git would have written.\n'
            span_id: 126
          ) (Token id:Id.Lit_Chars val:'\t{\n' span_id:127) 
          (Token
            id: Id.Lit_Chars
            val: '\t\techo "# pack-refs with: peeled " &&\n'
            span_id: 128
          ) (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/heads/master" &&\n' span_id:129) 
          (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/outside/foo" &&\n' span_id:130) (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/tags/base" &&\n' span_id:131) 
          (Token id:Id.Lit_Chars val:'\t\tprint_ref "refs/tags/foo" &&\n' span_id:132) (Token id:Id.Lit_Chars val:'\t\techo "^$(git rev-parse "refs/tags/foo^{}")"\n' span_id:133) 
          (Token id:Id.Lit_Chars val:'\t} >tmp &&\n' span_id:134) (Token id:Id.Lit_Chars val:'\tmv tmp .git/packed-refs\n' span_id:135)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'refs are peeled outside of refs/tags (old packed)'
            span_id: 142
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:146) 
          (Token id:Id.Lit_Chars val:'\tgit show-ref -d >actual &&\n' span_id:147) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:148)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'peeled refs survive deletion of packed ref' span_id:155))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:159) 
          (Token id:Id.Lit_Chars val:'\tgit pack-refs --all &&\n' span_id:160) (Token id:Id.Lit_Chars val:'\tcp .git/packed-refs fully-peeled &&\n' span_id:161) 
          (Token id:Id.Lit_Chars val:'\tgit branch yadda &&\n' span_id:162) (Token id:Id.Lit_Chars val:'\tgit pack-refs --all &&\n' span_id:163) 
          (Token id:Id.Lit_Chars val:'\tgit branch -d yadda &&\n' span_id:164) (Token id:Id.Lit_Chars val:'\ttest_cmp fully-peeled .git/packed-refs\n' span_id:165)
        )
      }
    )
    (C {(test_done)})
  ]
)