(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 <'git reset\n'> <'\n'> <'Documented tests for git reset'>)}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <.>
      more_env: []
      words: [{<.>} {<'./test-lib.sh'>}]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <commit_msg>
      name: commit_msg
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              left: <Id.Lit_VarLike 'msg='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'msg='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'msg='> name:msg)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ <'modify 2nd file (ge'> <Id.Lit_BadBackslash '\\'> <303> 
                        <Id.Lit_BadBackslash '\\'> <'244ndert)'> <Id.Lit_BadBackslash '\\'> <n>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.If
              if_kw: <Id.KW_If if>
              arms: [
                (IfArm
                  keyword: <Id.KW_If if>
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Simple
                          blame_tok: <test>
                          more_env: []
                          words: [{<test>} {<-n>} {(DQ ($ Id.VSub_Number 1))}]
                          redirects: []
                          do_fork: T
                        )
                      ]
                    )
                  then_kw: <Id.KW_Then then>
                  action: [
                    (command.Pipeline
                      children: [
                        (command.Simple
                          blame_tok: <printf>
                          more_env: []
                          words: [{<printf>} {(DQ ($ Id.VSub_DollarName msg))}]
                          redirects: []
                          do_fork: T
                        )
                        (command.Simple
                          blame_tok: <iconv>
                          more_env: []
                          words: [{<iconv>} {<-f>} {<utf-8>} {<-t>} {(DQ ($ Id.VSub_Number 1))}]
                          redirects: []
                          do_fork: T
                        )
                      ]
                      ops: [<Id.Op_Pipe _>]
                    )
                  ]
                  spids: [58 69]
                )
              ]
              else_kw: <Id.KW_Else else>
              else_action: [
                (command.Simple
                  blame_tok: <printf>
                  more_env: []
                  words: [{<printf>} {(DQ ($ Id.VSub_DollarName msg))}]
                  redirects: []
                  do_fork: T
                )
              ]
              fi_kw: <Id.KW_Fi fi>
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'test_encoding='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'test_encoding='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_encoding='> name:test_encoding)
          op: assign_op.Equal
          rhs: {(DQ <ISO8859-1>)}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'creating initial files and commits'>)}
        {
          (SQ <'\n'> <'\ttest_tick &&\n'> <'\techo "1st file" >first &&\n'> <'\tgit add first &&\n'> 
            <'\tgit commit -m "create 1st file" &&\n'> <'\n'> <'\techo "2nd file" >second &&\n'> <'\tgit add second &&\n'> 
            <'\tgit commit -m "create 2nd file" &&\n'> <'\n'> <'\techo "2nd line 1st file" >>first &&\n'> <'\tgit commit -a -m "modify 1st file" &&\n'> <'\n'> 
            <'\tgit rm first &&\n'> <'\tgit mv second secondfile &&\n'> <'\tgit commit -a -m "remove 1st and rename 2nd" &&\n'> <'\n'> 
            <'\techo "1st line 2nd file" >secondfile &&\n'> <'\techo "2nd line 2nd file" >>secondfile &&\n'> 
            <'\t# "git commit -m" would break MinGW, as Windows refuse to pass\n'> <'\t# $test_encoding encoded parameter to git.\n'> 
            <
'\tcommit_msg $test_encoding | git -c "i18n.commitEncoding=$test_encoding" commit -a -F - &&\n'
            > <'\thead5=$(git rev-parse --verify HEAD)\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <check_changes>
      name: check_changes
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <test>
                  more_env: []
                  words: [
                    {<test>}
                    {
                      (DQ 
                        (CommandSub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (command.Simple
                              blame_tok: <git>
                              more_env: []
                              words: [{<git>} {<rev-parse>} {<HEAD>}]
                              redirects: []
                              do_fork: T
                            )
                          right: <Id.Eof_RParen _>
                        )
                      )
                    }
                    {<Id.Lit_Equals '='>}
                    {(DQ ($ Id.VSub_Number 1))}
                  ]
                  redirects: []
                  do_fork: T
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      blame_tok: <git>
                      more_env: []
                      words: [{<git>} {<diff>}]
                      redirects: []
                      do_fork: T
                    )
                    (command.Simple
                      blame_tok: <test_cmp>
                      more_env: []
                      words: [{<test_cmp>} {<.diff_expect>} {<->}]
                      redirects: []
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      blame_tok: <git>
                      more_env: []
                      words: [{<git>} {<diff>} {<--cached>}]
                      redirects: []
                      do_fork: T
                    )
                    (command.Simple
                      blame_tok: <test_cmp>
                      more_env: []
                      words: [{<test_cmp>} {<.cached_expect>} {<->}]
                      redirects: []
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
                (command.Pipeline
                  children: [
                    (command.ForEach
                      keyword: <Id.KW_For for>
                      iter_names: [FILE]
                      iterable: (for_iter.Words words:[{<Id.Lit_Star '*'>}])
                      body: 
                        (command.DoGroup
                          left: <Id.KW_Do do>
                          children: [
                            (command.Simple
                              blame_tok: <echo>
                              more_env: []
                              words: [{<echo>} {($ Id.VSub_DollarName FILE) (SQ <':'>)}]
                              redirects: []
                              do_fork: T
                            )
                            (command.AndOr
                              children: [
                                (command.Simple
                                  blame_tok: <cat>
                                  more_env: []
                                  words: [{<cat>} {($ Id.VSub_DollarName FILE)}]
                                  redirects: []
                                  do_fork: T
                                )
                                (command.ControlFlow
                                  keyword: <Id.ControlFlow_Return return>
                                )
                              ]
                              ops: [<Id.Op_DPipe _>]
                            )
                          ]
                          right: <Id.KW_Done done>
                        )
                      redirects: []
                    )
                    (command.Simple
                      blame_tok: <test_cmp>
                      more_env: []
                      words: [{<test_cmp>} {<.cat_expect>} {<->}]
                      redirects: []
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
              ]
              ops: [<Id.Op_DAmp _> <Id.Op_DAmp _> <Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset --hard message'>)}
        {
          (SQ <'\n'> <'\thex=$(git log -1 --format="%h") &&\n'> <'\tgit reset --hard > .actual &&\n'> 
            <'\techo HEAD is now at $hex $(commit_msg) > .expected &&\n'> <'\ttest_i18ncmp .expected .actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset --hard message (ISO8859-1 logoutputencoding)'>)}
        {
          (SQ <'\n'> <'\thex=$(git log -1 --format="%h") &&\n'> 
            <'\tgit -c "i18n.logOutputEncoding=$test_encoding" reset --hard > .actual &&\n'> <'\techo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&\n'> 
            <'\ttest_i18ncmp .expected .actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'giving a non existing revision should fail'>)}
        {
          (SQ <'\n'> <'\ttest_must_fail git reset aaaaaa &&\n'> 
            <'\ttest_must_fail git reset --mixed aaaaaa &&\n'> <'\ttest_must_fail git reset --soft aaaaaa &&\n'> <'\ttest_must_fail git reset --hard aaaaaa &&\n'> 
            <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset --soft with unmerged index should fail'>)}
        {
          (SQ <'\n'> <'\ttouch .git/MERGE_HEAD &&\n'> 
            <'\techo "100644 44c5b5884550c17758737edcced463447b91d42b 1\tun" |\n'> <'\t\tgit update-index --index-info &&\n'> <'\ttest_must_fail git reset --soft HEAD &&\n'> 
            <'\trm .git/MERGE_HEAD &&\n'> <'\tgit rm --cached -- un\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'giving paths with options different than --mixed should fail'>)}
        {
          (SQ <'\n'> <'\ttest_must_fail git reset --soft -- first &&\n'> 
            <'\ttest_must_fail git reset --hard -- first &&\n'> <'\ttest_must_fail git reset --soft HEAD^ -- first &&\n'> 
            <'\ttest_must_fail git reset --hard HEAD^ -- first &&\n'> <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'giving unrecognized options should fail'>)}
        {
          (SQ <'\n'> <'\ttest_must_fail git reset --other &&\n'> <'\ttest_must_fail git reset -o &&\n'> 
            <'\ttest_must_fail git reset --mixed --other &&\n'> <'\ttest_must_fail git reset --mixed -o &&\n'> <'\ttest_must_fail git reset --soft --other &&\n'> 
            <'\ttest_must_fail git reset --soft -o &&\n'> <'\ttest_must_fail git reset --hard --other &&\n'> <'\ttest_must_fail git reset --hard -o &&\n'> 
            <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'trying to do reset --soft with pending merge should fail'>)}
        {
          (SQ <'\n'> <'\tgit branch branch1 &&\n'> <'\tgit branch branch2 &&\n'> <'\n'> 
            <'\tgit checkout branch1 &&\n'> <'\techo "3rd line in branch1" >>secondfile &&\n'> <'\tgit commit -a -m "change in branch1" &&\n'> 
            <'\n'> <'\tgit checkout branch2 &&\n'> <'\techo "3rd line in branch2" >>secondfile &&\n'> 
            <'\tgit commit -a -m "change in branch2" &&\n'> <'\n'> <'\ttest_must_fail git merge branch1 &&\n'> <'\ttest_must_fail git reset --soft &&\n'> <'\n'> 
            <'\tprintf "1st line 2nd file\\n2nd line 2nd file\\n3rd line" >secondfile &&\n'> <'\tgit commit -a -m "the change in branch2" &&\n'> <'\n'> <'\tgit checkout master &&\n'> 
            <'\tgit branch -D branch1 branch2 &&\n'> <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'trying to do reset --soft with pending checkout merge should fail'>)}
        {
          (SQ <'\n'> <'\tgit branch branch3 &&\n'> <'\tgit branch branch4 &&\n'> <'\n'> 
            <'\tgit checkout branch3 &&\n'> <'\techo "3rd line in branch3" >>secondfile &&\n'> <'\tgit commit -a -m "line in branch3" &&\n'> <'\n'> 
            <'\tgit checkout branch4 &&\n'> <'\techo "3rd line in branch4" >>secondfile &&\n'> <'\n'> <'\tgit checkout -m branch3 &&\n'> 
            <'\ttest_must_fail git reset --soft &&\n'> <'\n'> <'\tprintf "1st line 2nd file\\n2nd line 2nd file\\n3rd line" >secondfile &&\n'> 
            <'\tgit commit -a -m "the line in branch3" &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tgit branch -D branch3 branch4 &&\n'> 
            <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'resetting to HEAD with no changes should succeed and do nothing'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\t\tcheck_changes $head5 &&\n'> 
            <'\tgit reset --hard HEAD &&\n'> <'\t\tcheck_changes $head5 &&\n'> <'\tgit reset --soft &&\n'> <'\t\tcheck_changes $head5 &&\n'> 
            <'\tgit reset --soft HEAD &&\n'> <'\t\tcheck_changes $head5 &&\n'> <'\tgit reset --mixed &&\n'> <'\t\tcheck_changes $head5 &&\n'> 
            <'\tgit reset --mixed HEAD &&\n'> <'\t\tcheck_changes $head5 &&\n'> <'\tgit reset &&\n'> <'\t\tcheck_changes $head5 &&\n'> 
            <'\tgit reset HEAD &&\n'> <'\t\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git a/secondfile b/secondfile\n'>
                <'index 1bbba79..44c5b58 100644\n'>
                <'--- a/secondfile\n'>
                <'+++ b/secondfile\n'>
                <'@@ -1 +1,2 @@\n'>
                <'-2nd file\n'>
                <'+1st line 2nd file\n'>
                <'+2nd line 2nd file\n'>
              ]
            )
        )
      ]
      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:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--soft reset only should show changes in diff --cached'>)}
        {
          (SQ <'\n'> <'\tgit reset --soft HEAD^ &&\n'> 
            <'\tcheck_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&\n'> <'\ttest "$(git rev-parse ORIG_HEAD)" = \\\n'> <'\t\t\t$head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'secondfile:\n'>
                <'1st line 2nd file\n'>
                <'2nd line 2nd file\n'>
                <'3rd line 2nd file\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'changing files and redo the last commit should succeed'>)}
        {
          (SQ <'\n'> <'\techo "3rd line 2nd file" >>secondfile &&\n'> 
            <'\tgit commit -a -C ORIG_HEAD &&\n'> <'\thead4=$(git rev-parse --verify HEAD) &&\n'> <'\tcheck_changes $head4 &&\n'> 
            <'\ttest "$(git rev-parse ORIG_HEAD)" = \\\n'> <'\t\t\t$head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'first:\n'>
                <'1st file\n'>
                <'2nd line 1st file\n'>
                <'second:\n'>
                <'2nd file\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--hard reset should change the files and undo commits permanently'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard HEAD~2 &&\n'> 
            <'\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n'> <'\ttest "$(git rev-parse ORIG_HEAD)" = \\\n'> <'\t\t\t$head4\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git a/first b/first\n'>
                <'deleted file mode 100644\n'>
                <'index 8206c22..0000000\n'>
                <'--- a/first\n'>
                <'+++ /dev/null\n'>
                <'@@ -1,2 +0,0 @@\n'>
                <'-1st file\n'>
                <'-2nd line 1st file\n'>
                <'diff --git a/second b/second\n'>
                <'deleted file mode 100644\n'>
                <'index 1bbba79..0000000\n'>
                <'--- a/second\n'>
                <'+++ /dev/null\n'>
                <'@@ -1 +0,0 @@\n'>
                <'-2nd file\n'>
                <'diff --git a/secondfile b/secondfile\n'>
                <'new file mode 100644\n'>
                <'index 0000000..44c5b58\n'>
                <'--- /dev/null\n'>
                <'+++ b/secondfile\n'>
                <'@@ -0,0 +1,2 @@\n'>
                <'+1st line 2nd file\n'>
                <'+2nd line 2nd file\n'>
              ]
            )
        )
      ]
      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:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'redoing changes adding them without commit them should succeed'>)}
        {
          (SQ <'\n'> <'\tgit rm first &&\n'> <'\tgit mv second secondfile &&\n'> <'\n'> 
            <'\techo "1st line 2nd file" >secondfile &&\n'> <'\techo "2nd line 2nd file" >>secondfile &&\n'> <'\tgit add secondfile &&\n'> 
            <'\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e\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:{<.diff_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git a/first b/first\n'>
                <'deleted file mode 100644\n'>
                <'index 8206c22..0000000\n'>
                <'--- a/first\n'>
                <'+++ /dev/null\n'>
                <'@@ -1,2 +0,0 @@\n'>
                <'-1st file\n'>
                <'-2nd line 1st file\n'>
                <'diff --git a/second b/second\n'>
                <'deleted file mode 100644\n'>
                <'index 1bbba79..0000000\n'>
                <'--- a/second\n'>
                <'+++ /dev/null\n'>
                <'@@ -1 +0,0 @@\n'>
                <'-2nd file\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--mixed reset to HEAD should unadd the files'>)}
        {
          (SQ <'\n'> <'\tgit reset &&\n'> 
            <'\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n'> <'\ttest "$(git rev-parse ORIG_HEAD)" = \\\n'> <'\t\t\tddaefe00f1da16864591c61fdc7adb5d7cd6b74e\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'redoing the last two commits should succeed'>)}
        {
          (SQ <'\n'> <'\tgit add secondfile &&\n'> 
            <'\tgit reset --hard ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n'> <'\n'> <'\tgit rm first &&\n'> <'\tgit mv second secondfile &&\n'> 
            <'\tgit commit -a -m "remove 1st and rename 2nd" &&\n'> <'\n'> <'\techo "1st line 2nd file" >secondfile &&\n'> <'\techo "2nd line 2nd file" >>secondfile &&\n'> 
            <'\t# "git commit -m" would break MinGW, as Windows refuse to pass\n'> <'\t# $test_encoding encoded parameter to git.\n'> 
            <
'\tcommit_msg $test_encoding | git -c "i18n.commitEncoding=$test_encoding" commit -a -F - &&\n'
            > <'\tcheck_changes $head5\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'secondfile:\n'>
                <'1st line 2nd file\n'>
                <'2nd line 2nd file\n'>
                <'3rd line in branch2\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--hard reset to HEAD should clear a failed merge'>)}
        {
          (SQ <'\n'> <'\tgit branch branch1 &&\n'> <'\tgit branch branch2 &&\n'> <'\n'> 
            <'\tgit checkout branch1 &&\n'> <'\techo "3rd line in branch1" >>secondfile &&\n'> <'\tgit commit -a -m "change in branch1" &&\n'> 
            <'\n'> <'\tgit checkout branch2 &&\n'> <'\techo "3rd line in branch2" >>secondfile &&\n'> 
            <'\tgit commit -a -m "change in branch2" &&\n'> <'\thead3=$(git rev-parse --verify HEAD) &&\n'> <'\n'> <'\ttest_must_fail git pull . branch1 &&\n'> 
            <'\tgit reset --hard &&\n'> <'\tcheck_changes $head3\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.diff_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <Id.Redir_Great '>'>
      more_env: []
      words: []
      redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cached_expect>})]
      do_fork: F
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.cat_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'secondfile:\n'> <'1st line 2nd file\n'> <'2nd line 2nd file\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--hard reset to ORIG_HEAD should clear a fast-forward merge'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard HEAD^ &&\n'> <'\tcheck_changes $head5 &&\n'> <'\n'> 
            <'\tgit pull . branch1 &&\n'> <'\tgit reset --hard ORIG_HEAD &&\n'> <'\tcheck_changes $head5 &&\n'> <'\n'> 
            <'\tgit checkout master &&\n'> <'\tgit branch -D branch1 branch2 &&\n'> <'\tcheck_changes $head5\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: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git a/file1 b/file1\n'>
                <'index d00491f..7ed6ff8 100644\n'>
                <'--- a/file1\n'>
                <'+++ b/file1\n'>
                <'@@ -1 +1 @@\n'>
                <'-1\n'>
                <'+5\n'>
                <'diff --git a/file2 b/file2\n'>
                <'deleted file mode 100644\n'>
                <'index 0cfbf08..0000000\n'>
                <'--- a/file2\n'>
                <'+++ /dev/null\n'>
                <'@@ -1 +0,0 @@\n'>
                <'-2\n'>
              ]
            )
        )
      ]
      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:{<cached_expect>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git a/file4 b/file4\n'>
                <'new file mode 100644\n'>
                <'index 0000000..b8626c4\n'>
                <'--- /dev/null\n'>
                <'+++ b/file4\n'>
                <'@@ -0,0 +1 @@\n'>
                <'+4\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'test --mixed <paths>'>)}
        {
          (SQ <'\n'> <'\techo 1 > file1 &&\n'> <'\techo 2 > file2 &&\n'> <'\tgit add file1 file2 &&\n'> 
            <'\ttest_tick &&\n'> <'\tgit commit -m files &&\n'> <'\tgit rm file2 &&\n'> <'\techo 3 > file3 &&\n'> 
            <'\techo 4 > file4 &&\n'> <'\techo 5 > file1 &&\n'> <'\tgit add file1 file3 file4 &&\n'> 
            <'\tgit reset HEAD -- file1 file2 file3 &&\n'> <'\ttest_must_fail git diff --quiet &&\n'> <'\tgit diff > output &&\n'> 
            <'\ttest_cmp output expect &&\n'> <'\tgit diff --cached > output &&\n'> <'\ttest_cmp output cached_expect\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'test resetting the index at give paths'>)}
        {
          (SQ <'\n'> <'\n'> <'\tmkdir sub &&\n'> <'\t>sub/file1 &&\n'> <'\t>sub/file2 &&\n'> 
            <'\tgit update-index --add sub/file1 sub/file2 &&\n'> <'\tT=$(git write-tree) &&\n'> <'\tgit reset HEAD sub/file2 &&\n'> 
            <'\ttest_must_fail git diff --quiet &&\n'> <'\tU=$(git write-tree) &&\n'> <'\techo "$T" &&\n'> <'\techo "$U" &&\n'> 
            <'\ttest_must_fail git diff-index --cached --exit-code "$T" &&\n'> <'\ttest "$T" != "$U"\n'> <'\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'resetting an unmodified path is a no-op'>)}
        {
          (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit reset -- file1 &&\n'> 
            <'\tgit diff-files --exit-code &&\n'> <'\tgit diff-index --cached --exit-code HEAD\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: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<'Unstaged changes after reset:\n'> <'M\tfile2\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--mixed refreshes the index'>)}
        {
          (SQ <'\n'> <'\techo 123 >> file2 &&\n'> <'\tgit reset --mixed HEAD > output &&\n'> 
            <'\ttest_i18ncmp expect output\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'resetting specific path that is unmerged'>)}
        {
          (SQ <'\n'> <'\tgit rm --cached file2 &&\n'> <'\tF1=$(git rev-parse HEAD:file1) &&\n'> 
            <'\tF2=$(git rev-parse HEAD:file2) &&\n'> <'\tF3=$(git rev-parse HEAD:secondfile) &&\n'> <'\t{\n'> <'\t\techo "100644 $F1 1\tfile2" &&\n'> 
            <'\t\techo "100644 $F2 2\tfile2" &&\n'> <'\t\techo "100644 $F3 3\tfile2"\n'> <'\t} | git update-index --index-info &&\n'> 
            <'\tgit ls-files -u &&\n'> <'\tgit reset HEAD file2 &&\n'> <'\ttest_must_fail git diff --quiet &&\n'> 
            <'\tgit diff-index --exit-code --cached HEAD\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'disambiguation (1)'>)}
        {
          (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\t>secondfile &&\n'> 
            <'\tgit add secondfile &&\n'> <'\tgit reset secondfile &&\n'> <'\ttest_must_fail git diff --quiet -- secondfile &&\n'> 
            <'\ttest -z "$(git diff --cached --name-only)" &&\n'> <'\ttest -f secondfile &&\n'> <'\ttest_must_be_empty secondfile\n'> <'\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'disambiguation (2)'>)}
        {
          (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\t>secondfile &&\n'> 
            <'\tgit add secondfile &&\n'> <'\trm -f secondfile &&\n'> <'\ttest_must_fail git reset secondfile &&\n'> 
            <'\ttest -n "$(git diff --cached --name-only -- secondfile)" &&\n'> <'\ttest ! -f secondfile\n'> <'\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'disambiguation (3)'>)}
        {
          (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\t>secondfile &&\n'> 
            <'\tgit add secondfile &&\n'> <'\trm -f secondfile &&\n'> <'\tgit reset HEAD secondfile &&\n'> 
            <'\ttest_must_fail git diff --quiet &&\n'> <'\ttest -z "$(git diff --cached --name-only)" &&\n'> <'\ttest ! -f secondfile\n'> <'\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'disambiguation (4)'>)}
        {
          (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\t>secondfile &&\n'> 
            <'\tgit add secondfile &&\n'> <'\trm -f secondfile &&\n'> <'\tgit reset -- secondfile &&\n'> 
            <'\ttest_must_fail git diff --quiet &&\n'> <'\ttest -z "$(git diff --cached --name-only)" &&\n'> <'\ttest ! -f secondfile\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset with paths accepts tree'>)}
        {
          (SQ <'\n'> <'\t# for simpler tests, drop last commit containing added files\n'> 
            <'\tgit reset --hard HEAD^ &&\n'> <'\tgit reset HEAD^^{tree} -- . &&\n'> <'\tgit diff --cached HEAD^ --exit-code &&\n'> 
            <'\tgit diff HEAD --exit-code\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset -N keeps removed files as intent-to-add'>)}
        {
          (SQ <'\n'> <'\techo new-file >new-file &&\n'> <'\tgit add new-file &&\n'> 
            <'\tgit reset -N HEAD &&\n'> <'\n'> <'\ttree=$(git write-tree) &&\n'> <'\tgit ls-tree $tree new-file >actual &&\n'> 
            <'\t>expect &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\tgit diff --name-only >actual &&\n'> 
            <'\techo new-file >expect &&\n'> <'\ttest_cmp expect actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'reset --mixed sets up work tree'>)}
        {
          (SQ <'\n'> <'\tgit init mixed_worktree &&\n'> <'\t(\n'> <'\t\tcd mixed_worktree &&\n'> 
            <'\t\ttest_commit dummy\n'> <'\t) &&\n'> <'\t: >expect &&\n'> 
            <'\tgit --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset >actual &&\n'> <'\ttest_cmp expect actual\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_done>
      more_env: []
      words: [{<test_done>}]
      redirects: []
      do_fork: T
    )
  ]
)