(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"git reset\n"> <"\n"> <"Documented tests for git reset">)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: commit_msg
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:msg)
                  op: Equal
                  rhs: 
                    {
                      (DQ ("modify 2nd file (ge") (EscapedLiteralPart token:<Lit_EscapedChar "\\3">) 
                        (03) (EscapedLiteralPart token:<Lit_EscapedChar "\\2">) ("44ndert)") 
                        (EscapedLiteralPart token:<Lit_EscapedChar "\\n">)
                      )
                    }
                  spids: [46]
                )
              ]
              spids: [46]
            )
            (If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number "$1"))})]
                  action: [
                    (Pipeline
                      children: [
                        (C {(printf)} {(DQ ($ VSub_Name "$msg"))})
                        (C {(iconv)} {(-f)} {(utf-8)} {(-t)} {(DQ ($ VSub_Number "$1"))})
                      ]
                      negated: False
                    )
                  ]
                  spids: [-1 68]
                )
              ]
              else_action: [(C {(printf)} {(DQ ($ VSub_Name "$msg"))})]
              spids: [92 102]
            )
          ]
          spids: [31]
        )
      spids: [26 30]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_encoding)
          op: Equal
          rhs: {(DQ (ISO8859-1))}
          spids: [110]
        )
      ]
      spids: [110]
    )
    (C {(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">
        )
      }
    )
    (FuncDef
      name: check_changes
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(test)} 
                  {
                    (DQ 
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})])
                        left_token: <Left_CommandSub "$(">
                        spids: [163 169]
                      )
                    )
                  } {(Lit_Other "=")} {(DQ ($ VSub_Number "$1"))}
                )
                (AndOr
                  children: [
                    (Pipeline
                      children: [(C {(git)} {(diff)}) (C {(test_cmp)} {(.diff_expect)} {(-)})]
                      negated: False
                    )
                    (AndOr
                      children: [
                        (Pipeline
                          children: [
                            (C {(git)} {(diff)} {(--cached)})
                            (C {(test_cmp)} {(.cached_expect)} {(-)})
                          ]
                          negated: False
                        )
                        (Pipeline
                          children: [
                            (ForEach
                              iter_name: FILE
                              iter_words: [{(Lit_Other "*")}]
                              do_arg_iter: False
                              body: 
                                (DoGroup
                                  children: [
                                    (C {(echo)} {($ VSub_Name "$FILE") (SQ <":">)})
                                    (AndOr
                                      children: [
                                        (C {(cat)} {($ VSub_Name "$FILE")})
                                        (ControlFlow
                                          token: <ControlFlow_Return return>
                                        )
                                      ]
                                      op_id: Op_DPipe
                                    )
                                  ]
                                  spids: [222 242]
                                )
                              spids: [218 -1]
                            )
                            (C {(test_cmp)} {(.cat_expect)} {(-)})
                          ]
                          negated: False
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [157]
        )
      spids: [152 156]
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[285])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[288])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[293])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [296]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[468])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[473])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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_expansion: True
          here_end: EOF
          was_filled: True
          spids: [476]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[489])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [492]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[513])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[516])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[521])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n") 
                ("3rd line 2nd file\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [524]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[550])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[553])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[558])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("first:\n") ("1st file\n") ("2nd line 1st file\n") ("second:\n") ("2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [561]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[586])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[591])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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_expansion: True
          here_end: EOF
          was_filled: True
          spids: [594]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[622])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [625]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[653])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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_expansion: True
          here_end: EOF
          was_filled: True
          spids: [656]
        )
      ]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[674])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[679])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [682]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[703])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[706])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[711])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [714]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[744])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[747])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[752])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n") 
                ("3rd line in branch2\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [755]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.diff_expect)} spids:[788])]
    )
    (SimpleCommand
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.cached_expect)} spids:[791])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(.cat_expect)} spids:[796])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("secondfile:\n") ("1st line 2nd file\n") ("2nd line 2nd file\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [799]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[830])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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_expansion: True
          here_end: EOF
          was_filled: True
          spids: [834]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(cached_expect)} spids:[854])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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_expansion: True
          here_end: EOF
          was_filled: True
          spids: [858]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[938])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("Unstaged changes after reset:\n") ("M\tfile2\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [942]
        )
      ]
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(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">
        )
      }
    )
    (C {(test_done)})
  ]
)