(command.CommandList
  children: [
    (command.ShAssignment
      left: <Id.Lit_VarLike 'test_description='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'test_description='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'checkout into detached HEAD state'>)}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <.>
      more_env: []
      words: [{<.>} {<'./test-lib.sh'>}]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <check_detached>
      name: check_detached
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <test_must_fail>
              more_env: []
              words: [{<test_must_fail>} {<git>} {<symbolic-ref>} {<-q>} {<HEAD>}]
              redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <check_not_detached>
      name: check_not_detached
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <git>
              more_env: []
              words: [{<git>} {<symbolic-ref>} {<-q>} {<HEAD>}]
              redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'PREV_HEAD_DESC='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'PREV_HEAD_DESC='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PREV_HEAD_DESC='> name:PREV_HEAD_DESC)
          op: assign_op.Equal
          rhs: {(SQ <'Previous HEAD position was'>)}
        )
      ]
      redirects: []
    )
    (command.ShFunction
      name_tok: <check_orphan_warning>
      name: check_orphan_warning
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <test_i18ngrep>
                  more_env: []
                  words: [
                    {<test_i18ngrep>}
                    {(DQ <'you are leaving '> ($ Id.VSub_Number 2) <' behind'>)}
                    {(DQ ($ Id.VSub_Number 1))}
                  ]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <test_i18ngrep>
                  more_env: []
                  words: [
                    {<test_i18ngrep>}
                    {<Id.KW_Bang '!'>}
                    {(DQ ($ Id.VSub_DollarName PREV_HEAD_DESC))}
                    {(DQ ($ Id.VSub_Number 1))}
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <check_no_orphan_warning>
      name: check_no_orphan_warning
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <test_i18ngrep>
                  more_env: []
                  words: [
                    {<test_i18ngrep>}
                    {<Id.KW_Bang '!'>}
                    {(DQ <'you are leaving .* commit.*behind'>)}
                    {(DQ ($ Id.VSub_Number 1))}
                  ]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <test_i18ngrep>
                  more_env: []
                  words: [
                    {<test_i18ngrep>}
                    {(DQ ($ Id.VSub_DollarName PREV_HEAD_DESC))}
                    {(DQ ($ Id.VSub_Number 1))}
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <reset>
      name: reset
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [{<git>} {<checkout>} {<master>}]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <check_not_detached>
                  more_env: []
                  words: [{<check_not_detached>}]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <setup>)}
        {
          (SQ <'\n'> <'\ttest_commit one &&\n'> <'\ttest_commit two &&\n'> 
            <'\ttest_commit three && git tag -d three &&\n'> <'\ttest_commit four && git tag -d four &&\n'> <'\tgit branch branch &&\n'> <'\tgit tag tag\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout branch does not detach'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout branch &&\n'> <'\tcheck_not_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout tag detaches'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout tag &&\n'> <'\tcheck_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout branch by full name detaches'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout refs/heads/branch &&\n'> <'\tcheck_detached\n'>)
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout non-ref detaches'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout branch^ &&\n'> <'\tcheck_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout ref^0 detaches'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout branch^0 &&\n'> <'\tcheck_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detach detaches'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout --detach branch &&\n'> <'\tcheck_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detach without branch name'>)}
        {(SQ <'\n'> <'\treset &&\n'> <'\tgit checkout --detach &&\n'> <'\tcheck_detached\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detach errors out for non-commit'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\ttest_must_fail git checkout --detach one^{tree} &&\n'> 
            <'\tcheck_not_detached\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detach errors out for extra argument'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout master &&\n'> 
            <'\ttest_must_fail git checkout --detach tag one.t &&\n'> <'\tcheck_not_detached\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detached and -b are incompatible'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\ttest_must_fail git checkout --detach -b newbranch tag &&\n'> 
            <'\tcheck_not_detached\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout --detach moves HEAD'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout one &&\n'> <'\tgit checkout --detach two &&\n'> 
            <'\tgit diff --exit-code HEAD &&\n'> <'\tgit diff --exit-code two\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout warns on orphan commits'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout --detach two &&\n'> 
            <'\techo content >orphan &&\n'> <'\tgit add orphan &&\n'> <'\tgit commit -a -m orphan1 &&\n'> <'\techo new content >orphan &&\n'> 
            <'\tgit commit -a -m orphan2 &&\n'> <'\torphan2=$(git rev-parse HEAD) &&\n'> <'\tgit checkout master 2>stderr\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout warns on orphan commits: output'>)}
        {(SQ <'\n'> <'\tcheck_orphan_warning stderr "2 commits"\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout warns orphaning 1 of 2 commits'>)}
        {(SQ <'\n'> <'\tgit checkout "$orphan2" &&\n'> <'\tgit checkout HEAD^ 2>stderr\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout warns orphaning 1 of 2 commits: output'>)}
        {(SQ <'\n'> <'\tcheck_orphan_warning stderr "1 commit"\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout does not warn leaving ref tip'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout --detach two &&\n'> 
            <'\tgit checkout master 2>stderr\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout does not warn leaving ref tip'>)}
        {(SQ <'\n'> <'\tcheck_no_orphan_warning stderr\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout does not warn leaving reachable commit'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit checkout --detach HEAD^ &&\n'> 
            <'\tgit checkout master 2>stderr\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout does not warn leaving reachable commit'>)}
        {(SQ <'\n'> <'\tcheck_no_orphan_warning stderr\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(SQ <EOF>)}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'Your branch is behind \'master\' by 1 commit, and can be fast-forwarded.\n'>
                <'  (use "git pull" to update your local branch)\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'tracking count is accurate after orphan check'>)}
        {
          (SQ <'\n'> <'\treset &&\n'> <'\tgit branch child master^ &&\n'> 
            <'\tgit config branch.child.remote . &&\n'> <'\tgit config branch.child.merge refs/heads/master &&\n'> <'\tgit checkout child^ &&\n'> 
            <'\tgit checkout child >stdout &&\n'> <'\ttest_i18ncmp expect stdout\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'no advice given for explicit detached head state'>)}
        {
          (SQ <'\n'> <'\t# baseline\n'> <'\ttest_config advice.detachedHead true &&\n'> 
            <'\tgit checkout child && git checkout HEAD^0 >expect.advice 2>&1 &&\n'> <'\ttest_config advice.detachedHead false &&\n'> 
            <'\tgit checkout child && git checkout HEAD^0 >expect.no-advice 2>&1 &&\n'> <'\ttest_unconfig advice.detachedHead &&\n'> 
            <'\t# without configuration, the advice.* variables default to true\n'> <'\tgit checkout child && git checkout HEAD^0 >actual 2>&1 &&\n'> 
            <'\ttest_cmp expect.advice actual &&\n'> <'\n'> <'\t# with explicit --detach\n'> <'\t# no configuration\n'> 
            <'\ttest_unconfig advice.detachedHead &&\n'> <'\tgit checkout child && git checkout --detach HEAD^0 >actual 2>&1 &&\n'> 
            <'\ttest_cmp expect.no-advice actual &&\n'> <'\n'> <'\t# explicitly decline advice\n'> <'\ttest_config advice.detachedHead false &&\n'> 
            <'\tgit checkout child && git checkout --detach HEAD^0 >actual 2>&1 &&\n'> <'\ttest_cmp expect.no-advice actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_done>
      more_env: []
      words: [{<test_done>}]
      redirects: []
      do_fork: T
    )
  ]
)