(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'test describe\n'> <'\n'> <'                       B\n'> 
                <'        .--------------o----o----o----x\n'> <'       /                   /    /\n'> <' o----o----o----o----o----.    /\n'> 
                <'       \\        A    c        /\n'> <'        .------------o---o---o\n'> <'                   D,R   e\n'>
              )
            }
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: check_describe
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:expect)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [30]
                )
              ]
            )
            (C {<shift>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:R)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Simple
                            words: [{<git>} {<describe>} {(DQ ($ Id.VSub_At '$@'))}]
                            redirects: [
                              (redir
                                op: <Id.Redir_Great '2>'>
                                loc: (redir_loc.Fd fd:2)
                                arg: {<err.actual>}
                              )
                            ]
                            do_fork: T
                          )
                      )
                    }
                  spids: [39]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:S)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [54]
                )
              ]
            )
            (command.Simple
              words: [{<cat>} {<err.actual>}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<3>})]
              do_fork: T
            )
            (C {<test_expect_success>} {(DQ <'describe '> ($ Id.VSub_Star '$*'))} 
              {
                (SQ <'\n'> <'\ttest $S = 0 &&\n'> <'\tcase "$R" in\n'> <'\t$expect)\techo happy ;;\n'> 
                  <'\t*)\techo "Oops - $R is not $expect";\n'> <'\t\tfalse ;;\n'> <'\tesac\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> 
          <'\techo one >file && git add file && git commit -m initial &&\n'> <'\tone=$(git rev-parse HEAD) &&\n'> <'\n'> <'\tgit describe --always HEAD &&\n'> <'\n'> 
          <'\ttest_tick &&\n'> <'\techo two >file && git add file && git commit -m second &&\n'> <'\ttwo=$(git rev-parse HEAD) &&\n'> 
          <'\n'> <'\ttest_tick &&\n'> <'\techo three >file && git add file && git commit -m third &&\n'> <'\n'> 
          <'\ttest_tick &&\n'> <'\techo A >file && git add file && git commit -m A &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit tag -a -m A A &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo c >file && git add file && git commit -m c &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit tag c &&\n'> <'\n'> <'\tgit reset --hard $two &&\n'> <'\ttest_tick &&\n'> 
          <'\techo B >side && git add side && git commit -m B &&\n'> <'\ttest_tick &&\n'> <'\tgit tag -a -m B B &&\n'> <'\n'> <'\ttest_tick &&\n'> 
          <'\tgit merge -m Merged c &&\n'> <'\tmerged=$(git rev-parse HEAD) &&\n'> <'\n'> <'\tgit reset --hard $two &&\n'> <'\ttest_tick &&\n'> 
          <'\techo D >another && git add another && git commit -m D &&\n'> <'\ttest_tick &&\n'> <'\tgit tag -a -m D D &&\n'> <'\ttest_tick &&\n'> <'\tgit tag -a -m R R &&\n'> 
          <'\n'> <'\ttest_tick &&\n'> <'\techo DD >another && git commit -a -m another &&\n'> <'\n'> <'\ttest_tick &&\n'> 
          <'\tgit tag e &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo DDD >another && git commit -a -m "yet another" &&\n'> <'\n'> 
          <'\ttest_tick &&\n'> <'\tgit merge -m Merged $merged &&\n'> <'\n'> <'\ttest_tick &&\n'> 
          <'\techo X >file && echo X >side && git add file side &&\n'> <'\tgit commit -m x\n'> <'\n'>
        )
      }
    )
    (C {<check_describe>} {<A-> <Id.Lit_Star '*'>} {<HEAD>})
    (C {<check_describe>} {<A-> <Id.Lit_Star '*'>} {<HEAD> <Id.Lit_Other '^'>})
    (C {<check_describe>} {<R-> <Id.Lit_Star '*'>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'>})
    (C {<check_describe>} {<A-> <Id.Lit_Star '*'>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2>})
    (C {<check_describe>} {<B>} {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2> <Id.Lit_Other '^'>})
    (C {<check_describe>} {<R-> <Id.Lit_Star '*'>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<c-> <Id.Lit_Star '*'>} {<--tags>} {<HEAD>})
    (C {<check_describe>} {<c-> <Id.Lit_Star '*'>} {<--tags>} {<HEAD> <Id.Lit_Other '^'>})
    (C {<check_describe>} {<e-> <Id.Lit_Star '*'>} {<--tags>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<c-> <Id.Lit_Star '*'>} {<--tags>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2>}
    )
    (C {<check_describe>} {<B>} {<--tags>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<e>} {<--tags>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<'heads/master'>} {<--all>} {<HEAD>})
    (C {<check_describe>} {<'tags/c-'> <Id.Lit_Star '*'>} {<--all>} {<HEAD> <Id.Lit_Other '^'>})
    (C {<check_describe>} {<'tags/e'>} {<--all>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<B-0-> <Id.Lit_Star '*'>} {<--long>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2> <Id.Lit_Other '^'>}
    )
    (C {<check_describe>} {<A-3-> <Id.Lit_Star '*'>} {<--long>} 
      {<HEAD> <Id.Lit_Other '^'> <Id.Lit_Other '^'> <2>}
    )
    (C {<check_describe>} {<c-7-> <Id.Lit_Star '*'>} {<--tags>})
    (C {<check_describe>} {<e-3-> <Id.Lit_Star '*'>} {<--first-parent>} {<--tags>})
    (C {<test_expect_success>} {(SQ <'describe --contains defaults to HEAD without commit-ish'>)} 
      {
        (SQ <'\n'> <'\techo "A^0" >expect &&\n'> <'\tgit checkout A &&\n'> 
          <'\ttest_when_finished "git checkout -" &&\n'> <'\tgit describe --contains >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (command.Simple
      words: [{<Id.Lit_Colon ':'>}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<err.expect>})]
      do_fork: T
    )
    (C {<check_describe>} {<A>} {<--all>} {<A> <Id.Lit_Other '^'> <0>})
    (C {<test_expect_success>} {(SQ <'no warning was displayed for A'>)} 
      {(SQ <'\n'> <'\ttest_cmp err.expect err.actual\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'rename tag A to Q locally'>)} 
      {(SQ <'\n'> <'\tmv .git/refs/tags/A .git/refs/tags/Q\n'>)}
    )
    (command.Simple
      words: [{<cat>} {<->}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<err.expect>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_span_id: 414
              stdin_parts: [<'warning: tag \'A\' is really \'Q\' here\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<check_describe>} {<A-> <Id.Lit_Star '*'>} {<HEAD>})
    (C {<test_expect_success>} {(SQ <'warning was displayed for Q'>)} 
      {(SQ <'\n'> <'\ttest_i18ncmp err.expect err.actual\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'rename tag Q back to A'>)} 
      {(SQ <'\n'> <'\tmv .git/refs/tags/Q .git/refs/tags/A\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'pack tag refs'>)} {(SQ <'git pack-refs'>)})
    (C {<check_describe>} {<A-> <Id.Lit_Star '*'>} {<HEAD>})
    (C {<check_describe>} {(DQ <'A-*[0-9a-f]'>)} {<--dirty>})
    (C {<test_expect_success>} {(SQ <'set-up dirty work tree'>)} {(SQ <'\n'> <'\techo >>file\n'>)})
    (C {<check_describe>} {(DQ <'A-*[0-9a-f]-dirty'>)} {<--dirty>})
    (C {<check_describe>} {(DQ <'A-*[0-9a-f].mod'>)} {<--dirty> <Id.Lit_Equals '='> <.mod>})
    (C {<test_expect_success>} {(SQ <'describe --dirty HEAD'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git describe --dirty HEAD\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'set-up matching pattern tests'>)} 
      {
        (SQ <'\n'> <'\tgit tag -a -m test-annotated test-annotated &&\n'> <'\techo >>file &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit commit -a -m "one more" &&\n'> <'\tgit tag test1-lightweight &&\n'> <'\techo >>file &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit commit -a -m "yet another" &&\n'> <'\tgit tag test2-lightweight &&\n'> <'\techo >>file &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit commit -a -m "even more"\n'> <'\n'>
        )
      }
    )
    (C {<check_describe>} {(DQ <'test-annotated-*'>)} {<--match> <Id.Lit_Equals '='> (DQ <'test-*'>)})
    (C {<check_describe>} {(DQ <'test1-lightweight-*'>)} {<--tags>} 
      {<--match> <Id.Lit_Equals '='> (DQ <'test1-*'>)}
    )
    (C {<check_describe>} {(DQ <'test2-lightweight-*'>)} {<--tags>} 
      {<--match> <Id.Lit_Equals '='> (DQ <'test2-*'>)}
    )
    (C {<check_describe>} {(DQ <'test2-lightweight-*'>)} {<--long>} {<--tags>} 
      {<--match> <Id.Lit_Equals '='> (DQ <'test2-*'>)} {<HEAD> <Id.Lit_Other '^'>}
    )
    (C {<test_expect_success>} {(SQ <'name-rev with exact tags'>)} 
      {
        (SQ <'\n'> <'\techo A >expect &&\n'> <'\ttag_object=$(git rev-parse refs/tags/A) &&\n'> 
          <'\tgit name-rev --tags --name-only $tag_object >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\techo "A^0" >expect &&\n'> 
          <'\ttagged_commit=$(git rev-parse "refs/tags/A^0") &&\n'> <'\tgit name-rev --tags --name-only $tagged_commit >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'describe --contains with the exact tags'>)} 
      {
        (SQ <'\n'> <'\techo "A^0" >expect &&\n'> <'\ttag_object=$(git rev-parse refs/tags/A) &&\n'> 
          <'\tgit describe --contains $tag_object >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\techo "A^0" >expect &&\n'> 
          <'\ttagged_commit=$(git rev-parse "refs/tags/A^0") &&\n'> <'\tgit describe --contains $tagged_commit >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)