(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <'git merge\n'> <'\n'> <'Testing basic merge operations/option parsing.\n'> <'\n'> 
                <'! [c0] commit 0\n'> <' ! [c1] commit 1\n'> <'  ! [c2] commit 2\n'> <'   ! [c3] commit 3\n'> <'    ! [c4] c4\n'> 
                <'     ! [c5] c5\n'> <'      ! [c6] c6\n'> <'       * [master] Merge commit '>
              ) (c1) (SQ <'\n'> <'--------\n'> <'       - [master] Merge commit '>) (c1) 
              (SQ <'\n'> <' +     * [c1] commit 1\n'> <'      +  [c6] c6\n'> <'     +   [c5] c5\n'> 
                <'    ++   [c4] c4\n'> <'   ++++  [c3] commit 3\n'> <'  +      [c2] commit 2\n'> <'+++++++* [c0] commit 0\n'>
              )
            }
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/lib-gpg.sh)})
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file.1)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(SQ <'5 X'>)} {(6)} {(7)} {(8)} {(9)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file.5)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 X'>)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file.9)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 Y'>)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file.9y)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result.1)})]
    )
    (command.SimpleCommand
      words: [
        {(printf)}
        {(SQ <'%s\\n'>)}
        {(SQ <'1 X'>)}
        {(2)}
        {(3)}
        {(4)}
        {(SQ <'5 X'>)}
        {(6)}
        {(7)}
        {(8)}
        {(9)}
      ]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result.1-5)})]
    )
    (command.SimpleCommand
      words: [
        {(printf)}
        {(SQ <'%s\\n'>)}
        {(SQ <'1 X'>)}
        {(2)}
        {(3)}
        {(4)}
        {(SQ <'5 X'>)}
        {(6)}
        {(7)}
        {(8)}
        {(SQ <'9 X'>)}
      ]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result.1-5-9)})]
    )
    (command.SimpleCommand
      words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 Z'>)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result.9z)})]
    )
    (command.SimpleCommand
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(empty)})]
    )
    (command.FuncDef
      name: create_merge_msgs
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ("Merge tag 'c2'"))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(msg.1-5)})]
                )
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ("Merge tags 'c2' and 'c3'"))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(msg.1-5-9)})]
                )
                (command.BraceGroup
                  children: [
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp]
                      children: [
                        (C {(echo)} {(DQ ('Squashed commit of the following:'))})
                        (C {(echo)})
                        (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c1)})
                      ]
                    )
                  ]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(squash.1)})]
                )
                (command.BraceGroup
                  children: [
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp]
                      children: [
                        (C {(echo)} {(DQ ('Squashed commit of the following:'))})
                        (C {(echo)})
                        (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c2)})
                      ]
                    )
                  ]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(squash.1-5)})]
                )
                (command.BraceGroup
                  children: [
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp]
                      children: [
                        (C {(echo)} {(DQ ('Squashed commit of the following:'))})
                        (C {(echo)})
                        (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c2)} {(c3)})
                      ]
                    )
                  ]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(squash.1-5-9)})]
                )
                (command.SimpleCommand
                  words: [{(Lit_Other ':')}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(msg.nologff)})]
                )
                (command.SimpleCommand
                  words: [{(Lit_Other ':')}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(msg.nolognoff)})]
                )
                (command.BraceGroup
                  children: [
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [(C {(echo)} {(DQ ("* tag 'c3':"))}) (C {(echo)} {(DQ ('  commit 3'))})]
                    )
                  ]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(msg.log)})]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_merge
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (C {(test_cmp)} {(DQ ($ VSub_Number '$2'))} {(DQ ($ VSub_Number '$1'))})
                (C {(git)} {(update-index)} {(--refresh)})
                (C {(git)} {(diff)} {(--exit-code)})
                (command.If
                  arms: [
                    (if_arm
                      cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number '$3'))})]
                      action: [
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (command.SimpleCommand
                              words: [
                                {(git)}
                                {(show)}
                                {(-s)}
                                {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (Lit_Other '%') (s)}
                                {(HEAD)}
                              ]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(msg.act)}
                                )
                              ]
                            )
                            (C {(test_cmp)} {(DQ ($ VSub_Number '$3'))} {(msg.act)})
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_head
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ($ VSub_Number '$1'))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(head.expected)})]
                )
                (command.SimpleCommand
                  words: [{(git)} {(rev-parse)} {(HEAD)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(head.actual)})]
                )
                (C {(test_cmp)} {(head.expected)} {(head.actual)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_parents
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_At '$@'))}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(parents.expected)}
                    )
                  ]
                )
                (command.SimpleCommand
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(parents.actual)}
                    )
                  ]
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(lhs_expr.LhsName name:i) op:Equal rhs:{(1)})]
                )
                (command.WhileUntil
                  keyword: <KW_While while>
                  cond: [(C {(test)} {($ VSub_DollarName '$i')} {(-le)} {($ VSub_Pound '$#')})]
                  body: 
                    (command.DoGroup
                      children: [
                        (command.AndOr
                          ops: [Op_DAmp Op_DPipe]
                          children: [
                            (command.SimpleCommand
                              words: [
                                {(git)}
                                {(rev-parse)}
                                {(HEAD) (Lit_Other '^') ($ VSub_DollarName '$i')}
                              ]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_DGreat '>>'>
                                  fd: 16777215
                                  arg_word: {(parents.actual)}
                                )
                              ]
                            )
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:i)
                                  op: Equal
                                  rhs: 
                                    {
                                      (word_part.CommandSubPart
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (C {(expr)} {($ VSub_DollarName '$i')} {(Lit_Other '+')} 
                                                {(1)}
                                              )
                                            ]
                                          )
                                        left_token: <Left_CommandSub '$('>
                                      )
                                    }
                                )
                              ]
                            )
                            (command.ControlFlow
                              token: <ControlFlow_Return return>
                              arg_word: {(1)}
                            )
                          ]
                        )
                      ]
                    )
                )
                (C {(test_must_fail)} {(git)} {(rev-parse)} {(--verify)} 
                  {(DQ ('HEAD^') ($ VSub_DollarName '$i'))}
                )
                (C {(test_cmp)} {(parents.expected)} {(parents.actual)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_mergeheads
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_At '$@'))}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(mergehead.expected)}
                    )
                  ]
                )
                (command.WhileUntil
                  keyword: <KW_While while>
                  cond: [(C {(read)} {(sha1)} {(rest)})]
                  body: 
                    (command.DoGroup
                      children: [(C {(git)} {(rev-parse)} {($ VSub_DollarName '$sha1')})]
                    )
                  redirects: [
                    (redir.Redir
                      op: <Redir_Less '<'>
                      fd: 16777215
                      arg_word: {(.git/MERGE_HEAD)}
                    )
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(mergehead.actual)}
                    )
                  ]
                )
                (C {(test_cmp)} {(mergehead.expected)} {(mergehead.actual)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_no_mergehead
      body: 
        (command.BraceGroup
          children: [(command.Pipeline children:[(C {(test)} {(-e)} {(.git/MERGE_HEAD)})] negated:T)]
        )
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 0" &&\n'> 
          <'\tgit tag c0 &&\n'> <'\tc0=$(git rev-parse HEAD) &&\n'> <'\tcp file.1 file &&\n'> <'\tgit add file &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit commit -m "commit 1" &&\n'> <'\tgit tag c1 &&\n'> <'\tc1=$(git rev-parse HEAD) &&\n'> 
          <'\tgit reset --hard "$c0" &&\n'> <'\tcp file.5 file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m "commit 2" &&\n'> <'\tgit tag c2 &&\n'> <'\tc2=$(git rev-parse HEAD) &&\n'> <'\tgit reset --hard "$c0" &&\n'> 
          <'\tcp file.9y file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 7" &&\n'> <'\tgit tag c7 &&\n'> 
          <'\tgit reset --hard "$c0" &&\n'> <'\tcp file.9 file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m "commit 3" &&\n'> <'\tgit tag c3 &&\n'> <'\tc3=$(git rev-parse HEAD) &&\n'> <'\tgit reset --hard "$c0" &&\n'> 
          <'\tcreate_merge_msgs\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'test option parsing'>)} 
      {
        (SQ <'\n'> <'\ttest_must_fail git merge -$ c1 &&\n'> 
          <'\ttest_must_fail git merge --no-such c1 &&\n'> <'\ttest_must_fail git merge -s foobar c1 &&\n'> <'\ttest_must_fail git merge -s=foobar c1 &&\n'> 
          <'\ttest_must_fail git merge -m &&\n'> <'\ttest_must_fail git merge\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge -h with invalid index'>)} 
      {
        (SQ <'\n'> <'\tmkdir broken &&\n'> <'\t(\n'> <'\t\tcd broken &&\n'> <'\t\tgit init &&\n'> 
          <'\t\t>.git/index &&\n'> <'\t\ttest_expect_code 129 git merge -h 2>usage\n'> <'\t) &&\n'> 
          <'\ttest_i18ngrep "[Uu]sage: git merge" broken/usage\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'reject non-strategy with a git-merge-foo name'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git merge -s index c1\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'merge c0 with c1'>)} 
      {
        (SQ <'\n'> <'\techo "OBJID HEAD@{0}: merge c1: Fast-forward" >reflog.expected &&\n'> <'\n'> 
          <'\tgit reset --hard c0 &&\n'> <'\tgit merge c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head "$c1" &&\n'> <'\n'> 
          <'\tgit reflog -1 >reflog.actual &&\n'> <'\tsed "s/$_x05[0-9a-f]*/OBJID/g" reflog.actual >reflog.fuzzy &&\n'> 
          <'\ttest_cmp reflog.expected reflog.fuzzy\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 with --ff-only'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --ff-only c1 &&\n'> 
          <'\tgit merge --ff-only HEAD c0 c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head "$c1"\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge from unborn branch'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f master &&\n'> <'\ttest_might_fail git branch -D kid &&\n'> <'\n'> 
          <'\techo "OBJID HEAD@{0}: initial pull" >reflog.expected &&\n'> <'\n'> <'\tgit checkout --orphan kid &&\n'> <'\ttest_when_finished "git checkout -f master" &&\n'> 
          <'\tgit rm -fr . &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --ff-only c1 &&\n'> <'\tverify_merge file result.1 &&\n'> 
          <'\tverify_head "$c1" &&\n'> <'\n'> <'\tgit reflog -1 >reflog.actual &&\n'> 
          <'\tsed "s/$_x05[0-9a-f][0-9a-f]/OBJID/g" reflog.actual >reflog.fuzzy &&\n'> <'\ttest_cmp reflog.expected reflog.fuzzy\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c2 &&\n'> 
          <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge --squash c3 with c7'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c3 &&\n'> <'\ttest_must_fail git merge --squash c7 &&\n'> 
          <'\tcat result.9z >file &&\n'> <'\tgit commit --no-edit -a &&\n'> <'\n'> <'\t{\n'> <'\t\tcat <<-EOF\n'> 
          <'\t\tSquashed commit of the following:\n'> <'\n'> <'\t\t$(git show -s c7)\n'> <'\n'> <'\t\t# Conflicts:\n'> <'\t\t#\tfile\n'> <'\t\tEOF\n'> 
          <'\t} >expect &&\n'> <'\tgit cat-file commit HEAD | sed -e '>
        ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) 
        (SQ <' >actual &&\n'> <'\ttest_cmp expect actual\n'>)
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c2 c3 &&\n'> 
          <'\tverify_merge file result.1-5-9 msg.1-5-9 &&\n'> <'\tverify_parents $c1 $c2 $c3\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merges with --ff-only'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> 
          <'\ttest_must_fail git merge --ff-only c2 &&\n'> <'\ttest_must_fail git merge --ff-only c3 &&\n'> <'\ttest_must_fail git merge --ff-only c2 c3 &&\n'> 
          <'\tgit reset --hard c0 &&\n'> <'\tgit merge c3 &&\n'> <'\tverify_head $c3\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merges with merge.ff=only'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> 
          <'\ttest_config merge.ff "only" &&\n'> <'\ttest_must_fail git merge c2 &&\n'> <'\ttest_must_fail git merge c3 &&\n'> 
          <'\ttest_must_fail git merge c2 c3 &&\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge c3 &&\n'> <'\tverify_head $c3\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (no-commit)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-commit c1 &&\n'> 
          <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c1\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (no-commit)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --no-commit c2 &&\n'> 
          <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_mergeheads $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3 (no-commit)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --no-commit c2 c3 &&\n'> 
          <'\tverify_merge file result.1-5-9 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_mergeheads $c2 $c3\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (squash)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --squash c1 &&\n'> 
          <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c0 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1 .git/SQUASH_MSG\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (squash, ff-only)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --squash --ff-only c1 &&\n'> 
          <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c0 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1 .git/SQUASH_MSG\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (squash)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --squash c2 &&\n'> 
          <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5 .git/SQUASH_MSG\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'unsuccessful merge of c1 with c2 (squash, ff-only)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_must_fail git merge --squash --ff-only c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3 (squash)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --squash c2 c3 &&\n'> 
          <'\tverify_merge file result.1-5-9 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5-9 .git/SQUASH_MSG\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (no-commit in config)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--no-commit" &&\n'> <'\tgit merge c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> 
          <'\tverify_mergeheads $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (log in config)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --log c2 &&\n'> 
          <'\tgit show -s --pretty=tformat:%s%n%b >expect &&\n'> <'\n'> <'\ttest_config branch.master.mergeoptions "--log" &&\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\tgit merge c2 &&\n'> <'\tgit show -s --pretty=tformat:%s%n%b >actual &&\n'> <'\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (log in config gets overridden)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 &&\n'> 
          <'\tgit show -s --pretty=tformat:%s%n%b >expect &&\n'> <'\n'> <'\ttest_config branch.master.mergeoptions "--no-log" &&\n'> 
          <'\ttest_config merge.log "true" &&\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 &&\n'> 
          <'\tgit show -s --pretty=tformat:%s%n%b >actual &&\n'> <'\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (squash in config)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--squash" &&\n'> <'\tgit merge c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> 
          <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5 .git/SQUASH_MSG\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'override config option -n with --summary'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "-n" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --summary c2 >diffstat.txt &&\n'> 
          <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif ! grep "^ file |  *2 +-$" diffstat.txt\n'> <'\tthen\n'> 
          <'\t\techo "[OOPS] diffstat was not generated with --summary"\n'> <'\t\tfalse\n'> <'\tfi\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'override config option -n with --stat'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "-n" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --stat c2 >diffstat.txt &&\n'> 
          <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif ! grep "^ file |  *2 +-$" diffstat.txt\n'> <'\tthen\n'> 
          <'\t\techo "[OOPS] diffstat was not generated with --stat"\n'> <'\t\tfalse\n'> <'\tfi\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'override config option --stat'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--stat" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge -n c2 >diffstat.txt &&\n'> 
          <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif grep "^ file |  *2 +-$" diffstat.txt\n'> <'\tthen\n'> 
          <'\t\techo "[OOPS] diffstat was generated"\n'> <'\t\tfalse\n'> <'\tfi\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (override --no-commit)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--no-commit" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --commit c2 &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> 
          <'\tverify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c2 (override --squash)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--squash" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --no-squash c2 &&\n'> 
          <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (no-ff)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --no-ff c1 &&\n'> 
          <'\tverify_merge file result.1 &&\n'> <'\tverify_parents $c0 $c1\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (merge.ff=false)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff "false" &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit merge c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_parents $c0 $c1\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'combine branch.master.mergeoptions with merge.ff'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--ff" &&\n'> <'\ttest_config merge.ff "false" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c1 &&\n'> 
          <'\tverify_merge file result.1 &&\n'> <'\tverify_parents "$c0"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'tolerate unknown values for merge.ff'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff "something-new" &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit merge c1 2>message &&\n'> <'\tverify_head "$c1" &&\n'> <'\ttest_cmp empty message\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'combining --squash and --no-ff is refused'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\ttest_must_fail git merge --squash --no-ff c1 &&\n'> <'\ttest_must_fail git merge --no-ff --squash c1\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'option --ff-only overwrites --no-ff'>)} 
      {
        (SQ <'\n'> <'\tgit merge --no-ff --ff-only c1 &&\n'> 
          <'\ttest_must_fail git merge --no-ff --ff-only c2\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'option --no-ff overrides merge.ff=only config'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff only &&\n'> 
          <'\tgit merge --no-ff c1\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge c0 with c1 (ff overrides no-ff)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--no-ff" &&\n'> <'\tgit merge --ff c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c1\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge log message'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-log c2 &&\n'> 
          <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.nologff msg.act &&\n'> <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\ttest_config branch.master.mergeoptions "--no-ff" &&\n'> <'\tgit merge --no-log c2 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> 
          <'\ttest_cmp msg.nolognoff msg.act &&\n'> <'\n'> <'\tgit merge --log c3 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> 
          <'\ttest_cmp msg.log msg.act &&\n'> <'\n'> <'\tgit reset --hard HEAD^ &&\n'> <'\ttest_config merge.log "yes" &&\n'> <'\tgit merge c3 &&\n'> 
          <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.log msg.act\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c0, c2, c0, and c1'>)} 
      {
        (SQ <'\n'> <'       git reset --hard c1 &&\n'> <'       test_tick &&\n'> 
          <'       git merge c0 c2 c0 c1 &&\n'> <'       verify_merge file result.1-5 &&\n'> <'       verify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c0, c2, c0, and c1'>)} 
      {
        (SQ <'\n'> <'       git reset --hard c1 &&\n'> <'       test_tick &&\n'> 
          <'       git merge c0 c2 c0 c1 &&\n'> <'       verify_merge file result.1-5 &&\n'> <'       verify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge c1 with c1 and c2'>)} 
      {
        (SQ <'\n'> <'       git reset --hard c1 &&\n'> <'       test_tick &&\n'> 
          <'       git merge c1 c2 &&\n'> <'       verify_merge file result.1-5 &&\n'> <'       verify_parents $c1 $c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge fast-forward in a dirty tree'>)} 
      {
        (SQ <'\n'> <'       git reset --hard c0 &&\n'> <'       mv file file1 &&\n'> 
          <'       cat file1 >file &&\n'> <'       rm -f file1 &&\n'> <'       git merge c2\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'in-index merge'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-ff -s resolve c1 >out &&\n'> 
          <'\ttest_i18ngrep "Wonderful." out &&\n'> <'\tverify_parents $c0 $c1\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'refresh the index before merging'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tcp file file.n && mv -f file.n file &&\n'> 
          <'\tgit merge c3\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected.branch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 1864
          stdin_parts: [("Merge branch 'c5-branch' (early part)\n")]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected.tag)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 1875
          stdin_parts: [("Merge commit 'c5~1'\n")]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'merge early part of c2'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c3 &&\n'> <'\techo c4 >c4.c &&\n'> <'\tgit add c4.c &&\n'> 
          <'\tgit commit -m c4 &&\n'> <'\tgit tag c4 &&\n'> <'\techo c5 >c5.c &&\n'> <'\tgit add c5.c &&\n'> <'\tgit commit -m c5 &&\n'> 
          <'\tgit tag c5 &&\n'> <'\tgit reset --hard c3 &&\n'> <'\techo c6 >c6.c &&\n'> <'\tgit add c6.c &&\n'> 
          <'\tgit commit -m c6 &&\n'> <'\tgit tag c6 &&\n'> <'\tgit branch -f c5-branch c5 &&\n'> <'\tgit merge c5-branch~1 &&\n'> 
          <'\tgit show -s --pretty=tformat:%s HEAD >actual.branch &&\n'> <'\tgit reset --keep HEAD^ &&\n'> <'\tgit merge c5~1 &&\n'> 
          <'\tgit show -s --pretty=tformat:%s HEAD >actual.tag &&\n'> <'\ttest_cmp expected.branch actual.branch &&\n'> <'\ttest_cmp expected.tag actual.tag\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'merge --no-ff --no-commit && commit'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-ff --no-commit c1 &&\n'> 
          <'\tEDITOR=: git commit &&\n'> <'\tverify_parents $c0 $c1\n'>
        )
      }
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (C {(test_expect_success)} {(SQ <'amending no-ff merge commit'>)} 
      {(SQ <'\n'> <'\tEDITOR=: git commit --amend &&\n'> <'\tverify_parents $c0 $c1\n'>)}
    )
    (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)})
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(editor)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 1977
          stdin_parts: [
            ('#!/bin/sh\n')
            ('# Add a new message string that was not in the template\n')
            ('(\n')
            ('\techo "Merge work done on the side branch c1"\n')
            ('\techo\n')
            ('\tcat <"$1"\n')
            (') >"$1.tmp" && mv "$1.tmp" "$1"\n')
            ('# strip comments and blank lines from end of message\n')
            ('sed -e \'/^#/d\' < "$1" | sed -e :a -e \'/^\\n*$/{$d;N;ba\' -e \'}\' > expected\n')
          ]
        )
      ]
    )
    (C {(chmod)} {(755)} {(editor)})
    (C {(test_expect_success)} {(SQ <'merge --no-ff --edit'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\tEDITOR=./editor git merge --no-ff --edit c1 &&\n'> <'\tverify_parents $c0 $c1 &&\n'> <'\tgit cat-file commit HEAD >raw &&\n'> 
          <'\tgrep "work done on the side branch" raw &&\n'> <'\tsed "1,/^$/d" >actual raw &&\n'> <'\ttest_cmp actual expected\n'>
        )
      }
    )
    (C {(test_expect_success)} {(GPG)} {(SQ <'merge --ff-only tag'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\tgit commit --allow-empty -m "A newer commit" &&\n'> <'\tgit tag -s -m "A newer commit" signed &&\n'> <'\tgit reset --hard c0 &&\n'> <'\n'> 
          <'\tgit merge --ff-only signed &&\n'> <'\tgit rev-parse signed^0 >expect &&\n'> <'\tgit rev-parse HEAD >actual &&\n'> 
          <'\ttest_cmp actual expect\n'>
        )
      }
    )
    (C {(test_expect_success)} {(GPG)} {(SQ <'merge --no-edit tag should skip editor'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> 
          <'\tgit commit --allow-empty -m "A newer commit" &&\n'> <'\tgit tag -f -s -m "A newer commit" signed &&\n'> <'\tgit reset --hard c0 &&\n'> <'\n'> 
          <'\tEDITOR=false git merge --no-edit signed &&\n'> <'\tgit rev-parse signed^0 >expect &&\n'> <'\tgit rev-parse HEAD^2 >actual &&\n'> 
          <'\ttest_cmp actual expect\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'set up mod-256 conflict scenario'>)} 
      {
        (SQ <'\n'> <'\t# 256 near-identical stanzas...\n'> <'\tfor i in $(test_seq 1 256); do\n'> 
          <'\t\tfor j in 1 2 3 4 5; do\n'> <'\t\t\techo $i-$j\n'> <'\t\tdone\n'> <'\tdone >file &&\n'> <'\tgit add file &&\n'> 
          <'\tgit commit -m base &&\n'> <'\n'> <'\t# one side changes the first line of each to "master"\n'> 
          <'\tsed s/-1/-master/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -am master &&\n'> <'\n'> 
          <'\t# and the other to "side"; merging the two will\n'> <'\t# yield 256 separate conflicts\n'> <'\tgit checkout -b side HEAD^ &&\n'> 
          <'\tsed s/-1/-side/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -am side\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'merge detects mod-256 conflicts (recursive)'>)} 
      {(SQ <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git merge -s recursive master\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'merge detects mod-256 conflicts (resolve)'>)} 
      {(SQ <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git merge -s resolve master\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'merge nothing into void'>)} 
      {
        (SQ <'\n'> <'\tgit init void &&\n'> <'\t(\n'> <'\t\tcd void &&\n'> 
          <'\t\tgit remote add up .. &&\n'> <'\t\tgit fetch up &&\n'> <'\t\ttest_must_fail git merge FETCH_HEAD\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)