(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"git commit porcelain-ish">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: commit_msg_is
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:expect)
                  op: Equal
                  rhs: {(commit_msg_is.expect)}
                  spids: [23]
                )
              ]
              spids: [23]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:actual)
                  op: Equal
                  rhs: {(commit_msg_is.actual)}
                  spids: [27]
                )
              ]
              spids: [27]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(printf)}
                    {(DQ ("%s"))}
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (C {(git)} {(log)} 
                                  {(--pretty) (Lit_Other "=") (format) (Lit_Other ":") (Lit_Other "%") 
                                    (s) (Lit_Other "%") (b)
                                  } {(-1)}
                                )
                              ]
                            )
                          left_token: <Left_CommandSub "$(">
                          spids: [39 54]
                        )
                      )
                    }
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$actual")}
                      spids: [57]
                    )
                  ]
                )
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [{(printf)} {(DQ ("%s"))} {(DQ ($ VSub_Number "$1"))}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {($ VSub_Name "$expect")}
                          spids: [73]
                        )
                      ]
                    )
                    (C {(test_i18ncmp)} {($ VSub_Name "$expect")} {($ VSub_Name "$actual")})
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [20]
        )
      spids: [15 19]
    )
    (FuncDef
      name: check_summary_oneline
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(test_tick)})
                (AndOr
                  children: [
                    (Pipeline
                      children: [
                        (C {(git)} {(commit)} 
                          {
                            (BracedVarSub
                              token: <VSub_Number 3>
                              suffix_op: 
                                (StringUnary
                                  op_id: VTest_Plus
                                  arg_word: {(DQ ($ VSub_Number "$3"))}
                                )
                              spids: [107 113]
                            )
                          } {(-m)} {(DQ ($ VSub_Number "$2"))}
                        )
                        (SimpleCommand
                          words: [{(head)} {(-1)}]
                          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(act)} spids:[127])]
                        )
                      ]
                      negated: False
                    )
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:SUMMARY_PREFIX)
                              op: Equal
                              rhs: 
                                {
                                  (DQ 
                                    (CommandSubPart
                                      command_list: 
                                        (CommandList
                                          children: [(C {(git)} {(name-rev)} {(--name-only)} {(HEAD)})]
                                        )
                                      left_token: <Left_CommandSub "$(">
                                      spids: [141 149]
                                    )
                                  )
                                }
                              spids: [139]
                            )
                          ]
                          spids: [139]
                        )
                        (If
                          arms: [
                            (if_arm
                              cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number "$1"))})]
                              action: [
                                (Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (LhsName name:SUMMARY_PREFIX)
                                      op: Equal
                                      rhs: 
                                        {
                                          (DQ ($ VSub_Name "$SUMMARY_PREFIX") (" (") 
                                            ($ VSub_Number "$1") (")")
                                          )
                                        }
                                      spids: [174]
                                    )
                                  ]
                                  spids: [174]
                                )
                              ]
                              spids: [-1 171]
                            )
                          ]
                          spids: [-1 183]
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:SUMMARY_POSTFIX)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (C {(git)} {(log)} {(-1)} {(--pretty) (Lit_Other "=") (SQ <"format:%h">)})
                              ]
                            )
                          left_token: <Left_CommandSub "$(">
                          spids: [193 205]
                        )
                      )
                    }
                  spids: [191]
                )
              ]
              spids: [191]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(echo)}
                    {
                      (DQ ("[") ($ VSub_Name "$SUMMARY_PREFIX") (" ") ($ VSub_Name "$SUMMARY_POSTFIX") 
                        ("] ") ($ VSub_Number "$2")
                      )
                    }
                  ]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(exp)} spids:[220])]
                )
                (C {(test_i18ncmp)} {(exp)} {(act)})
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [95]
        )
      spids: [91 94]
    )
    (C {(test_expect_success)} {(SQ <"output summary format">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo new >file1 &&\n"> <"\tgit add file1 &&\n"> 
          <"\tcheck_summary_oneline \"root-commit\" \"initial\" &&\n"> <"\n"> <"\techo change >>file1 &&\n"> <"\tgit add file1\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"output summary format: root-commit">)} 
      {(SQ <"\n"> <"\tcheck_summary_oneline \"\" \"a change\"\n">)}
    )
    (C {(test_expect_success)} {(SQ <"output summary format for commit with an empty diff">)} 
      {(SQ <"\n"> <"\n"> <"\tcheck_summary_oneline \"\" \"empty\" \"--allow-empty\"\n">)}
    )
    (C {(test_expect_success)} {(SQ <"output summary format for merges">)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit checkout -b recursive-base &&\n"> <"\ttest_commit base file1 &&\n"> 
          <"\n"> <"\tgit checkout -b recursive-a recursive-base &&\n"> <"\ttest_commit commit-a file1 &&\n"> <"\n"> 
          <"\tgit checkout -b recursive-b recursive-base &&\n"> <"\ttest_commit commit-b file1 &&\n"> <"\n"> <"\t# conflict\n"> <"\tgit checkout recursive-a &&\n"> 
          <"\ttest_must_fail git merge recursive-b &&\n"> <"\t# resolve the conflict\n"> <"\techo commit-a > file1 &&\n"> <"\tgit add file1 &&\n"> 
          <"\tcheck_summary_oneline \"\" \"Merge\"\n">
        )
      }
    )
    (FuncDef
      name: output_tests_cleanup
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(git)} {(checkout)} {(master)})
                (AndOr
                  children: [(C {(git)} {(rm)} {(file1)}) (C {(git)} {(commit)} {(-m)} {(DQ (cleanup))})]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [311]
        )
      spids: [307 310]
    )
    (C {(test_expect_success)} {(SQ <"the basics">)} 
      {
        (SQ <"\n"> <"\n"> <"\toutput_tests_cleanup &&\n"> <"\n"> 
          <"\techo doing partial >\"commit is\" &&\n"> <"\tmkdir not &&\n"> <"\techo very much encouraged but we should >not/forbid &&\n"> 
          <"\tgit add \"commit is\" not &&\n"> <"\techo update added \"commit is\" file >\"commit is\" &&\n"> 
          <"\techo also update another >not/forbid &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a -m \"initial with -a\" &&\n"> <"\n"> 
          <"\tgit cat-file blob HEAD:\"commit is\" >current.1 &&\n"> <"\tgit cat-file blob HEAD:not/forbid >current.2 &&\n"> <"\n"> <"\tcmp current.1 \"commit is\" &&\n"> 
          <"\tcmp current.2 not/forbid\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <partial>)} 
      {
        (SQ <"\n"> <"\n"> <"\techo another >\"commit is\" &&\n"> <"\techo another >not/forbid &&\n"> 
          <"\ttest_tick &&\n"> <"\tgit commit -m \"partial commit to handle a file\" \"commit is\" &&\n"> <"\n"> 
          <"\tchanged=$(git diff-tree --name-only HEAD^ HEAD) &&\n"> <"\ttest \"$changed\" = \"commit is\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"partial modification in a subdirectory">)} 
      {
        (SQ <"\n"> <"\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -m \"partial commit to subdirectory\" not &&\n"> <"\n"> <"\tchanged=$(git diff-tree -r --name-only HEAD^ HEAD) &&\n"> 
          <"\ttest \"$changed\" = \"not/forbid\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"partial removal">)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit rm not/forbid &&\n"> 
          <"\tgit commit -m \"partial commit to remove not/forbid\" not &&\n"> <"\n"> <"\tchanged=$(git diff-tree -r --name-only HEAD^ HEAD) &&\n"> 
          <"\ttest \"$changed\" = \"not/forbid\" &&\n"> <"\tremain=$(git ls-tree -r --name-only HEAD) &&\n"> <"\ttest \"$remain\" = \"commit is\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"sign off">)} 
      {
        (SQ <"\n"> <"\n"> <"\t>positive &&\n"> <"\tgit add positive &&\n"> 
          <"\tgit commit -s -m \"thank you\" &&\n"> <"\tactual=$(git cat-file commit HEAD | sed -ne \"s/Signed-off-by: //p\") &&\n"> 
          <"\texpected=$(git var GIT_COMMITTER_IDENT | sed -e \"s/>.*/>/\") &&\n"> <"\ttest \"z$actual\" = \"z$expected\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"multiple -m">)} 
      {
        (SQ <"\n"> <"\n"> <"\t>negative &&\n"> <"\tgit add negative &&\n"> 
          <"\tgit commit -m \"one\" -m \"two\" -m \"three\" &&\n"> <"\tactual=$(git cat-file commit HEAD | sed -e \"1,/^\\$/d\") &&\n"> 
          <"\texpected=$(echo one; echo; echo two; echo; echo three) &&\n"> <"\ttest \"z$actual\" = \"z$expected\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <verbose>)} 
      {
        (SQ <"\n"> <"\n"> <"\techo minus >negative &&\n"> <"\tgit add negative &&\n"> 
          <"\tgit status -v | sed -ne \"/^diff --git /p\" >actual &&\n"> <"\techo \"diff --git a/negative b/negative\" >expect &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"verbose respects diff config">)} 
      {
        (SQ <"\n"> <"\n"> <"\ttest_config color.diff always &&\n"> <"\tgit status -v >actual &&\n"> 
          <"\tgrep \"\\[1mdiff --git\" actual\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:mesg_with_comment_and_newlines)
          op: Equal
          rhs: {(SQ <"\n"> <"# text\n"> <"\n">)}
          spids: [512]
        )
      ]
      spids: [512]
    )
    (C {(test_expect_success)} {(SQ <"prepare file with comment line and trailing newlines">)} 
      {(SQ <"\n"> <"\tprintf \"%s\" \"$mesg_with_comment_and_newlines\" >expect\n">)}
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (verbatim option,-t)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> 
          <"\tgit commit --cleanup=verbatim --no-status -t expect -a &&\n"> <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (verbatim option,-F)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> 
          <"\tgit commit --cleanup=verbatim -F expect -a &&\n"> <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (verbatim option,-m)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> 
          <"\tgit commit --cleanup=verbatim -m \"$mesg_with_comment_and_newlines\" -a &&\n"> <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (whitespace option,-F)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> <"\t{ echo;echo \"# text\";echo; } >text &&\n"> 
          <"\techo \"# text\" >expect &&\n"> <"\tgit commit --cleanup=whitespace -F text -a &&\n"> 
          <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (scissors option,-F,-e)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> <"\tcat >text <<EOF &&\n"> <"\n"> <"# to be kept\n"> 
          <"\n"> <"  # ------------------------ >8 ------------------------\n"> <"# to be kept, too\n"> 
          <"# ------------------------ >8 ------------------------\n"> <"to be removed\n"> <"# ------------------------ >8 ------------------------\n"> 
          <"to be removed, too\n"> <"EOF\n"> <"\n"> <"\tcat >expect <<EOF &&\n"> <"# to be kept\n"> <"\n"> 
          <"  # ------------------------ >8 ------------------------\n"> <"# to be kept, too\n"> <"EOF\n"> <"\tgit commit --cleanup=scissors -e -F text -a &&\n"> 
          <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"cleanup commit messages (scissors option,-F,-e, scissors on first line)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> <"\tcat >text <<EOF &&\n"> 
          <"# ------------------------ >8 ------------------------\n"> <"to be removed\n"> <"EOF\n"> 
          <"\tgit commit --cleanup=scissors -e -F text -a --allow-empty-message &&\n"> <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_must_be_empty actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (strip option,-F)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> 
          <"\t{ echo;echo \"# text\";echo sample;echo; } >text &&\n"> <"\techo sample >expect &&\n"> <"\tgit commit --cleanup=strip -F text -a &&\n"> 
          <"\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (strip option,-F,-e)">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> <"\t{ echo;echo sample;echo; } >text &&\n"> 
          <"\tgit commit -e -F text -a &&\n"> <"\thead -n 4 .git/COMMIT_EDITMSG >actual\n">
        )
      }
    )
    (SimpleCommand
      words: [
        {(echo)}
        {
          (DQ ("sample\n") ("\n") 
            ("# Please enter the commit message for your changes. Lines starting\n") ("# with '#' will be ignored, and an empty message aborts the commit.")
          )
        }
      ]
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[700])]
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit messages (strip option,-F,-e): output">)} 
      {(SQ <"\n"> <"\ttest_i18ncmp expect actual\n">)}
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (fail on invalid cleanup mode option)">)} 
      {(SQ <"\n"> <"\ttest_must_fail git commit --cleanup=non-existent\n">)}
    )
    (C {(test_expect_success)} 
      {(SQ <"cleanup commit message (fail on invalid cleanup mode configuration)">)} {(SQ <"\n"> <"\ttest_must_fail git -c commit.cleanup=non-existent commit\n">)}
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (no config and no option uses default)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> <"\t(\n"> 
          <"\t  test_set_editor \"$TEST_DIRECTORY\"/t7500/add-content-and-comment &&\n"> <"\t  git commit --no-status\n"> <"\t) &&\n"> <"\tcommit_msg_is \"commit message\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (option overrides default)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> <"\t(\n"> 
          <"\t  test_set_editor \"$TEST_DIRECTORY\"/t7500/add-content-and-comment &&\n"> <"\t  git commit --cleanup=whitespace --no-status\n"> <"\t) &&\n"> 
          <"\tcommit_msg_is \"commit message # comment\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (config overrides default)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> <"\t(\n"> 
          <"\t  test_set_editor \"$TEST_DIRECTORY\"/t7500/add-content-and-comment &&\n"> <"\t  git -c commit.cleanup=whitespace commit --no-status\n"> <"\t) &&\n"> 
          <"\tcommit_msg_is \"commit message # comment\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (option overrides config)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> <"\t(\n"> 
          <"\t  test_set_editor \"$TEST_DIRECTORY\"/t7500/add-content-and-comment &&\n"> <"\t  git -c commit.cleanup=whitespace commit --cleanup=default\n"> <"\t) &&\n"> 
          <"\tcommit_msg_is \"commit message\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (default, -m)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> 
          <"\tgit commit -m \"message #comment \" &&\n"> <"\tcommit_msg_is \"message #comment\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (whitespace option, -m)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> 
          <"\tgit commit --cleanup=whitespace --no-status -m \"message #comment \" &&\n"> <"\tcommit_msg_is \"message #comment\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"cleanup commit message (whitespace config, -m)">)} 
      {
        (SQ <"\n"> <"\techo content >>file &&\n"> <"\tgit add file &&\n"> 
          <"\tgit -c commit.cleanup=whitespace commit --no-status -m \"message #comment \" &&\n"> <"\tcommit_msg_is \"message #comment\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"message shows author when it is not equal to committer">)} 
      {
        (SQ <"\n"> <"\techo >>negative &&\n"> <"\tgit commit -e -m \"sample\" -a &&\n"> 
          <"\ttest_i18ngrep \\\n"> <"\t  \"^# Author: *A U Thor <author@example.com>\\$\" \\\n"> <"\t  .git/COMMIT_EDITMSG\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"message shows date when it is explicitly set">)} 
      {
        (SQ <"\n"> <"\tgit commit --allow-empty -e -m foo --date=\"2010-01-02T03:04:05\" &&\n"> 
          <"\ttest_i18ngrep \\\n"> <"\t  \"^# Date: *Sat Jan 2 03:04:05 2010 +0000\" \\\n"> <"\t  .git/COMMIT_EDITMSG\n">
        )
      }
    )
    (C {(test_expect_success)} {(AUTOIDENT)} {(SQ <"message shows committer when it is automatic">)} 
      {
        (SQ <"\n"> <"\n"> <"\techo >>negative &&\n"> <"\t(\n"> 
          <"\t\tsane_unset GIT_COMMITTER_EMAIL &&\n"> <"\t\tsane_unset GIT_COMMITTER_NAME &&\n"> <"\t\tgit commit -e -m \"sample\" -a\n"> <"\t) &&\n"> 
          <"\t# the ident is calculated from the system, so we cannot\n"> <"\t# check the actual value, only that it is there\n"> 
          <"\ttest_i18ngrep \"^# Committer: \" .git/COMMIT_EDITMSG\n">
        )
      }
    )
    (SimpleCommand
      words: [{(write_script)} {(.git/FAKE_EDITOR)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("echo editor started > ") (Right_DoubleQuote "\"") 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(pwd)})])
                  left_token: <Left_CommandSub "$(">
                  spids: [920 922]
                ) (/.git/result) (Right_DoubleQuote "\"") ("\n") ("exit 0\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [915]
        )
      ]
    )
    (C {(test_expect_success)} {(KW_Bang "!") (AUTOIDENT)} 
      {(SQ <"do not fire editor when committer is bogus">)} 
      {
        (SQ <"\n"> <"\t>.git/result &&\n"> <"\t>expect &&\n"> <"\n"> <"\techo >>negative &&\n"> <"\t(\n"> 
          <"\t\tsane_unset GIT_COMMITTER_EMAIL &&\n"> <"\t\tsane_unset GIT_COMMITTER_NAME &&\n"> <"\t\tGIT_EDITOR=\"\\\"$(pwd)/.git/FAKE_EDITOR\\\"\" &&\n"> 
          <"\t\texport GIT_EDITOR &&\n"> <"\t\ttest_must_fail git commit -e -m sample -a\n"> <"\t) &&\n"> <"\ttest_cmp expect .git/result\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"do not fire editor if -m <msg> was given">)} 
      {
        (SQ <"\n"> <"\techo tick >file &&\n"> <"\tgit add file &&\n"> 
          <"\techo \"editor not started\" >.git/result &&\n"> <"\t(GIT_EDITOR=\"\\\"$(pwd)/.git/FAKE_EDITOR\\\"\" git commit -m tick) &&\n"> 
          <"\ttest \"$(cat .git/result)\" = \"editor not started\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"do not fire editor if -m \"\" was given">)} 
      {
        (SQ <"\n"> <"\techo tock >file &&\n"> <"\tgit add file &&\n"> 
          <"\techo \"editor not started\" >.git/result &&\n"> <"\t(GIT_EDITOR=\"\\\"$(pwd)/.git/FAKE_EDITOR\\\"\" \\\n"> 
          <"\t git commit -m \"\" --allow-empty-message) &&\n"> <"\ttest \"$(cat .git/result)\" = \"editor not started\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"do not fire editor in the presence of conflicts">)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit clean -f &&\n"> <"\techo f >g &&\n"> <"\tgit add g &&\n"> 
          <"\tgit commit -m \"add g\" &&\n"> <"\tgit branch second &&\n"> <"\techo master >g &&\n"> <"\techo g >h &&\n"> <"\tgit add g h &&\n"> 
          <"\tgit commit -m \"modify g and add h\" &&\n"> <"\tgit checkout second &&\n"> <"\techo second >g &&\n"> <"\tgit add g &&\n"> 
          <"\tgit commit -m second &&\n"> <"\t# Must fail due to conflict\n"> <"\ttest_must_fail git cherry-pick -n master &&\n"> 
          <"\techo \"editor not started\" >.git/result &&\n"> <"\t(\n"> <"\t\tGIT_EDITOR=\"\\\"$(pwd)/.git/FAKE_EDITOR\\\"\" &&\n"> <"\t\texport GIT_EDITOR &&\n"> 
          <"\t\ttest_must_fail git commit\n"> <"\t) &&\n"> <"\ttest \"$(cat .git/result)\" = \"editor not started\"\n">
        )
      }
    )
    (SimpleCommand
      words: [{(write_script)} {(.git/FAKE_EDITOR)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {(DQ ("# kill -TERM command added below.\n"))}
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1025]
        )
      ]
    )
    (C {(test_expect_success)} {(EXECKEEPSPID)} {(SQ <"a SIGTERM should break locks">)} 
      {(SQ <"\n"> <"\techo >>negative &&\n"> <"\t! \"$SHELL_PATH\" -c ">) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <"\n"> <"\t  echo kill -TERM $$ >> .git/FAKE_EDITOR\n"> 
          <"\t  GIT_EDITOR=.git/FAKE_EDITOR\n"> <"\t  export GIT_EDITOR\n"> <"\t  exec git commit -a">
        ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <" &&\n"> <"\ttest ! -f .git/index.lock\n">)
      }
    )
    (C {(rm)} {(-f)} {(.git/MERGE_MSG)} {(.git/COMMIT_EDITMSG)})
    (C {(git)} {(reset)} {(-q)} {(--hard)})
    (C {(test_expect_success)} {(SQ <"Hand committing of a redundant merge removes dups">)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit rev-parse second master >expect &&\n"> 
          <"\ttest_must_fail git merge second master &&\n"> <"\tgit checkout master g &&\n"> <"\tEDITOR=: git commit -a &&\n"> 
          <"\tgit cat-file commit HEAD | sed -n -e \"s/^parent //p\" -e \"/^$/q\" >actual &&\n"> <"\ttest_cmp expect actual\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"A single-liner subject with a token plus colon is not a footer">)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> 
          <"\tgit commit -s -m \"hello: kitty\" --allow-empty &&\n"> <"\tgit cat-file commit HEAD | sed -e \"1,/^$/d\" >actual &&\n"> <"\ttest_line_count = 3 actual\n"> 
          <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"commit -s places sob on third line after two empty lines">)} 
      {
        (SQ <"\n"> <"\tgit commit -s --allow-empty --allow-empty-message &&\n"> 
          <"\tcat <<-EOF >expect &&\n"> <"\n"> <"\n"> <"\tSigned-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\n"> <"\n"> <"\tEOF\n"> 
          <"\tsed -e \"/^#/d\" -e \"s/^:.*//\" .git/COMMIT_EDITMSG >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(write_script)} {(.git/FAKE_EDITOR)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {("mv \"$1\" \"$1.orig\"\n") ("(\n") ("\techo message\n") ("\tcat \"$1.orig\"\n") 
              (") >\"$1\"\n")
            }
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [1135]
        )
      ]
    )
    (SimpleCommand
      words: [{(echo)} {(SQ <"## Custom template">)}]
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(template)} spids:[1146])]
    )
    (FuncDef
      name: try_commit
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(git)} {(reset)} {(--hard)})
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [{(echo)}]
                      redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(negative)} spids:[1169])]
                    )
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [
                            {(git)}
                            {(commit)}
                            {(-a)}
                            {($ VSub_Star "$*")}
                            {($ VSub_Name "$use_template")}
                          ]
                          more_env: [(env_pair name:GIT_EDITOR val:{(.git/FAKE_EDITOR)} spids:[1175])]
                        )
                        (Case
                          to_match: {(DQ ($ VSub_Name "$use_template"))}
                          arms: [
                            (case_arm
                              pat_list: [{(SQ )}]
                              action: [
                                (C {(test_i18ngrep)} {(KW_Bang "!")} {(DQ ("^## Custom template"))} 
                                  {(.git/COMMIT_EDITMSG)}
                                )
                              ]
                              spids: [-1 1202 1215 -1]
                            )
                            (case_arm
                              pat_list: [{(Lit_Other "*")}]
                              action: [
                                (C {(test_i18ngrep)} {(DQ ("^## Custom template"))} 
                                  {(.git/COMMIT_EDITMSG)}
                                )
                              ]
                              spids: [1218 1219 1230 -1]
                            )
                          ]
                          spids: [1191 1197 1233]
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [1155]
        )
      spids: [1150 1154]
    )
    (FuncDef
      name: try_commit_status_combo
      body: 
        (BraceGroup
          children: [
            (C {(test_expect_success)} {(SQ <commit>)} 
              {
                (SQ <"\n"> <"\t\ttry_commit \"\" &&\n"> 
                  <"\t\ttest_i18ngrep \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --status">)} 
              {
                (SQ <"\n"> <"\t\ttry_commit --status &&\n"> 
                  <"\t\ttest_i18ngrep \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --no-status">)} 
              {
                (SQ <"\n"> <"\t\ttry_commit --no-status &&\n"> 
                  <"\t\ttest_i18ngrep ! \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit with commit.status = yes">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status yes &&\n"> <"\t\ttry_commit \"\" &&\n"> 
                  <"\t\ttest_i18ngrep \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit with commit.status = no">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status no &&\n"> <"\t\ttry_commit \"\" &&\n"> 
                  <"\t\ttest_i18ngrep ! \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --status with commit.status = yes">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status yes &&\n"> <"\t\ttry_commit --status &&\n"> 
                  <"\t\ttest_i18ngrep \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --no-status with commit.status = yes">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status yes &&\n"> 
                  <"\t\ttry_commit --no-status &&\n"> <"\t\ttest_i18ngrep ! \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --status with commit.status = no">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status no &&\n"> <"\t\ttry_commit --status &&\n"> 
                  <"\t\ttest_i18ngrep \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
            (C {(test_expect_success)} {(SQ <"commit --no-status with commit.status = no">)} 
              {
                (SQ <"\n"> <"\t\ttest_config commit.status no &&\n"> 
                  <"\t\ttry_commit --no-status &&\n"> <"\t\ttest_i18ngrep ! \"^# Changes to be committed:\" .git/COMMIT_EDITMSG\n"> <"\t">
                )
              }
            )
          ]
          spids: [1243]
        )
      spids: [1238 1242]
    )
    (C {(try_commit_status_combo)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:use_template)
          op: Equal
          rhs: {(DQ ("-t template"))}
          spids: [1393]
        )
      ]
      spids: [1393]
    )
    (C {(try_commit_status_combo)})
    (C {(test_expect_success)} {(SQ <"commit --status with custom comment character">)} 
      {
        (SQ <"\n"> <"\ttest_config core.commentchar \";\" &&\n"> <"\ttry_commit --status &&\n"> 
          <"\ttest_i18ngrep \"^; Changes to be committed:\" .git/COMMIT_EDITMSG\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"switch core.commentchar">)} 
      {
        (SQ <"\n"> <"\ttest_commit \"#foo\" foo &&\n"> 
          <"\tGIT_EDITOR=.git/FAKE_EDITOR git -c core.commentChar=auto commit --amend &&\n"> <"\ttest_i18ngrep \"^; Changes to be committed:\" .git/COMMIT_EDITMSG\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"switch core.commentchar but out of options">)} 
      {
        (SQ <"\n"> <"\tcat >text <<\\EOF &&\n"> <"# 1\n"> <"; 2\n"> <"@ 3\n"> <"! 4\n"> <"$ 5\n"> <"% 6\n"> 
          <"^ 7\n"> <"& 8\n"> <"| 9\n"> <": 10\n"> <"EOF\n"> <"\tgit commit --amend -F text &&\n"> <"\t(\n"> 
          <"\t\ttest_set_editor .git/FAKE_EDITOR &&\n"> <"\t\ttest_must_fail git -c core.commentChar=auto commit --amend\n"> <"\t)\n">
        )
      }
    )
    (C {(test_done)})
  ]
)