(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 '>)}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <.>
      more_env: []
      words: [{<.>} {<'./test-lib.sh'>}]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <do_checkout>
      name: do_checkout
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'exp_branch='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'exp_branch='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'exp_branch='> name:exp_branch)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number 1)}
                    )
                  ]
                  redirects: []
                )
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'exp_ref='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'exp_ref='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'exp_ref='> name:exp_ref)
                      op: assign_op.Equal
                      rhs: {(DQ <'refs/heads/'> ($ Id.VSub_DollarName exp_branch))}
                    )
                  ]
                  redirects: []
                )
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'exp_sha='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'exp_sha='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'exp_sha='> name:exp_sha)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (BracedVarSub
                            left: <Id.Left_DollarBrace '${'>
                            token: <Id.VSub_Number 2>
                            var_name: 2
                            suffix_op: 
                              (suffix_op.Unary
                                op: <Id.VTest_ColonHyphen _>
                                arg_word: 
                                  {
                                    (CommandSub
                                      left_token: <Id.Left_DollarParen '$('>
                                      child: 
                                        (command.Simple
                                          blame_tok: <git>
                                          more_env: []
                                          words: [{<git>} {<rev-parse>} {<--verify>} {<HEAD>}]
                                          redirects: []
                                          do_fork: T
                                        )
                                      right: <Id.Eof_RParen _>
                                    )
                                  }
                              )
                            right: <Id.Right_DollarBrace '}'>
                          )
                        }
                    )
                  ]
                  redirects: []
                )
                (command.If
                  if_kw: <Id.KW_If if>
                  arms: [
                    (IfArm
                      keyword: <Id.KW_If if>
                      cond: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.Simple
                                  blame_tok: <Id.Lit_LBracket '['>
                                  more_env: []
                                  words: [
                                    {<Id.Lit_LBracket '['>}
                                    {<-z>}
                                    {(DQ ($ Id.VSub_Number 3))}
                                    {<Id.Lit_RBracket ']'>}
                                  ]
                                  redirects: []
                                  do_fork: T
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      then_kw: <Id.KW_Then then>
                      action: [
                        (command.ShAssignment
                          left: <Id.Lit_VarLike 'opts='>
                          pairs: [
                            (AssignPair
                              left: <Id.Lit_VarLike 'opts='>
                              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'opts='> name:opts)
                              op: assign_op.Equal
                              rhs: {(DQ <-b>)}
                            )
                          ]
                          redirects: []
                        )
                      ]
                      spids: [89 102]
                    )
                  ]
                  else_kw: <Id.KW_Else else>
                  else_action: [
                    (command.ShAssignment
                      left: <Id.Lit_VarLike 'opts='>
                      pairs: [
                        (AssignPair
                          left: <Id.Lit_VarLike 'opts='>
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'opts='> name:opts)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_Number 3))}
                        )
                      ]
                      redirects: []
                    )
                  ]
                  fi_kw: <Id.KW_Fi fi>
                  redirects: []
                )
              ]
              ops: [<Id.Op_DAmp _> <Id.Op_DAmp _> <Id.Op_DAmp _>]
            )
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [
                    {<git>}
                    {<checkout>}
                    {($ Id.VSub_DollarName opts)}
                    {($ Id.VSub_DollarName exp_branch)}
                    {($ Id.VSub_DollarName exp_sha)}
                  ]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <test>
                  more_env: []
                  words: [
                    {<test>}
                    {($ Id.VSub_DollarName exp_ref)}
                    {<Id.Lit_Equals '='>}
                    {
                      (CommandSub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Simple
                            blame_tok: <git>
                            more_env: []
                            words: [{<git>} {<rev-parse>} {<--symbolic-full-name>} {<HEAD>}]
                            redirects: []
                            do_fork: T
                          )
                        right: <Id.Eof_RParen _>
                      )
                    }
                  ]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <test>
                  more_env: []
                  words: [
                    {<test>}
                    {($ Id.VSub_DollarName exp_sha)}
                    {<Id.Lit_Equals '='>}
                    {
                      (CommandSub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Simple
                            blame_tok: <git>
                            more_env: []
                            words: [{<git>} {<rev-parse>} {<--verify>} {<HEAD>}]
                            redirects: []
                            do_fork: T
                          )
                        right: <Id.Eof_RParen _>
                      )
                    }
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _> <Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <test_dirty_unmergeable>
      name: test_dirty_unmergeable
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Pipeline
              negated: <Id.KW_Bang '!'>
              children: [
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [{<git>} {<diff>} {<--exit-code>}]
                  redirects: [
                    (Redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<'/dev/null'>}
                    )
                  ]
                  do_fork: T
                )
              ]
              ops: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <setup_dirty_unmergeable>
      name: setup_dirty_unmergeable
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <echo>
              more_env: []
              words: [{<echo>} {<change2>}]
              redirects: [(Redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<file1>})]
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <test_dirty_mergeable>
      name: test_dirty_mergeable
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Pipeline
              negated: <Id.KW_Bang '!'>
              children: [
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [{<git>} {<diff>} {<--cached>} {<--exit-code>}]
                  redirects: [
                    (Redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<'/dev/null'>}
                    )
                  ]
                  do_fork: T
                )
              ]
              ops: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <setup_dirty_mergeable>
      name: setup_dirty_mergeable
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <echo>
                  more_env: []
                  words: [{<echo>} {<file2>}]
                  redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file2>})]
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [{<git>} {<add>} {<file2>}]
                  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 initial file1 &&\n'> 
            <'\tHEAD1=$(git rev-parse --verify HEAD) &&\n'> <'\n'> <'\ttest_commit change1 file1 &&\n'> <'\tHEAD2=$(git rev-parse --verify HEAD) &&\n'> <'\n'> 
            <'\tgit branch -m branch1\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to a new branch, set to HEAD'>)}
        {(SQ <'\n'> <'\tdo_checkout branch2\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to a new branch, set to an explicit ref'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\tgit branch -D branch2 &&\n'> <'\n'> 
            <'\tdo_checkout branch2 $HEAD1\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to a new branch with unmergeable changes fails'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\t# clean up from previous test\n'> 
            <'\tgit branch -D branch2 &&\n'> <'\n'> <'\tsetup_dirty_unmergeable &&\n'> <'\ttest_must_fail do_checkout branch2 $HEAD1 &&\n'> 
            <'\ttest_dirty_unmergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -f -b to a new branch with unmergeable changes discards changes'>)}
        {
          (SQ <'\n'> <'\t# still dirty and on branch1\n'> <'\tdo_checkout branch2 $HEAD1 "-f -b" &&\n'> 
            <'\ttest_must_fail test_dirty_unmergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to a new branch preserves mergeable changes'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\t# clean up from previous test\n'> 
            <'\tgit branch -D branch2 &&\n'> <'\n'> <'\tsetup_dirty_mergeable &&\n'> <'\tdo_checkout branch2 $HEAD1 &&\n'> 
            <'\ttest_dirty_mergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -f -b to a new branch with mergeable changes discards changes'>)}
        {
          (SQ <'\n'> <'\t# clean up from previous test\n'> <'\tgit reset --hard &&\n'> <'\n'> 
            <'\tgit checkout branch1 &&\n'> <'\n'> <'\t# clean up from previous test\n'> <'\tgit branch -D branch2 &&\n'> <'\n'> 
            <'\tsetup_dirty_mergeable &&\n'> <'\tdo_checkout branch2 $HEAD1 "-f -b" &&\n'> <'\ttest_must_fail test_dirty_mergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to an existing branch fails'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard HEAD &&\n'> <'\n'> 
            <'\ttest_must_fail do_checkout branch2 $HEAD2\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b to @{-1} fails with the right branch name'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard HEAD &&\n'> <'\tgit checkout branch1 &&\n'> 
            <'\tgit checkout branch2 &&\n'> <'\techo  >expect "fatal: A branch named '>
          ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <branch1>) 
          (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') 
          (SQ <' already exists." &&\n'> <'\ttest_must_fail git checkout -b @{-1} 2>actual &&\n'> 
            <'\ttest_i18ncmp expect actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to an existing branch resets branch to HEAD'>)}
        {(SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\tdo_checkout branch2 "" -B\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to an existing branch from detached HEAD resets branch to HEAD'>)}
        {
          (SQ <'\n'> <'\tgit checkout $(git rev-parse --verify HEAD) &&\n'> <'\n'> 
            <'\tdo_checkout branch2 "" -B\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to an existing branch with an explicit ref resets branch to that ref'>)}
        {(SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\tdo_checkout branch2 $HEAD1 -B\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to an existing branch with unmergeable changes fails'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\tsetup_dirty_unmergeable &&\n'> 
            <'\ttest_must_fail do_checkout branch2 $HEAD1 -B &&\n'> <'\ttest_dirty_unmergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -f -B to an existing branch with unmergeable changes discards changes'>)}
        {
          (SQ <'\n'> <'\t# still dirty and on branch1\n'> <'\tdo_checkout branch2 $HEAD1 "-f -B" &&\n'> 
            <'\ttest_must_fail test_dirty_unmergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to an existing branch preserves mergeable changes'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\n'> <'\tsetup_dirty_mergeable &&\n'> 
            <'\tdo_checkout branch2 $HEAD1 -B &&\n'> <'\ttest_dirty_mergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -f -B to an existing branch with mergeable changes discards changes'>)}
        {
          (SQ <'\n'> <'\t# clean up from previous test\n'> <'\tgit reset --hard &&\n'> <'\n'> 
            <'\tgit checkout branch1 &&\n'> <'\n'> <'\tsetup_dirty_mergeable &&\n'> <'\tdo_checkout branch2 $HEAD1 "-f -B" &&\n'> 
            <'\ttest_must_fail test_dirty_mergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -b <describe>'>)}
        {
          (SQ <'\n'> <'\tgit tag -f -m "First commit" initial initial &&\n'> 
            <'\tgit checkout -f change1 &&\n'> <'\tname=$(git describe) &&\n'> <'\tgit checkout -b $name &&\n'> 
            <'\tgit diff --exit-code change1 &&\n'> <'\techo "refs/heads/$name" >expect &&\n'> <'\tgit symbolic-ref HEAD >actual &&\n'> 
            <'\ttest_cmp expect actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'checkout -B to the current branch works'>)}
        {
          (SQ <'\n'> <'\tgit checkout branch1 &&\n'> <'\tgit checkout -B branch1-scratch &&\n'> <'\n'> 
            <'\tsetup_dirty_mergeable &&\n'> <'\tgit checkout -B branch1-scratch initial &&\n'> <'\ttest_dirty_mergeable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_done>
      more_env: []
      words: [{<test_done>}]
      redirects: []
      do_fork: T
    )
  ]
)