(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git-am command-line options override saved options'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-terminal.sh'>})
    (command.ShFunction
      name: format_patch
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<git>} {<format-patch>} {<--stdout>} {<-1>} {(DQ ($ Id.VSub_Number '$1'))}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {(DQ ($ Id.VSub_Number '$1')) <.eml>}
                )
              ]
              do_fork: T
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\ttest_commit initial file &&\n'> <'\ttest_commit first file &&\n'> <'\n'> 
          <'\tgit checkout initial &&\n'> <'\tgit mv file file2 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m renamed-file &&\n'> 
          <'\tgit tag renamed-file &&\n'> <'\n'> <'\tgit checkout -b side initial &&\n'> <'\ttest_commit side1 file &&\n'> 
          <'\ttest_commit side2 file &&\n'> <'\n'> <'\tformat_patch side1 &&\n'> <'\tformat_patch side2\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'--3way overrides --no-3way'>)} 
      {
        (SQ <'\n'> <'\trm -fr .git/rebase-apply &&\n'> <'\tgit reset --hard &&\n'> 
          <'\tgit checkout renamed-file &&\n'> <'\n'> <'\t# Applying side1 will fail as the file has been renamed.\n'> 
          <'\ttest_must_fail git am --no-3way side[12].eml &&\n'> <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\ttest_cmp_rev renamed-file HEAD &&\n'> 
          <'\ttest -z "$(git ls-files -u)" &&\n'> <'\n'> <'\t# Applying side1 with am --3way will succeed due to the threeway-merge.\n'> 
          <'\t# Applying side2 will fail as --3way does not apply to it.\n'> <'\ttest_must_fail test_terminal git am --3way </dev/zero &&\n'> 
          <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\ttest side1 = "$(cat file2)"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--no-quiet overrides --quiet'>)} 
      {
        (SQ <'\n'> <'\trm -fr .git/rebase-apply &&\n'> <'\tgit reset --hard &&\n'> 
          <'\tgit checkout first &&\n'> <'\n'> <'\t# Applying side1 will be quiet.\n'> 
          <'\ttest_must_fail git am --quiet side[123].eml >out &&\n'> <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\ttest_i18ngrep ! "^Applying: " out &&\n'> 
          <'\techo side1 >file &&\n'> <'\tgit add file &&\n'> <'\n'> <'\t# Applying side1 will not be quiet.\n'> 
          <'\t# Applying side2 will be quiet.\n'> <'\tgit am --no-quiet --continue >out &&\n'> <'\techo "Applying: side1" >expected &&\n'> 
          <'\ttest_i18ncmp expected out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--signoff overrides --no-signoff'>)} 
      {
        (SQ <'\n'> <'\trm -fr .git/rebase-apply &&\n'> <'\tgit reset --hard &&\n'> 
          <'\tgit checkout first &&\n'> <'\n'> <'\ttest_must_fail git am --no-signoff side[12].eml &&\n'> 
          <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\techo side1 >file &&\n'> <'\tgit add file &&\n'> <'\tgit am --signoff --continue &&\n'> <'\n'> 
          <'\t# Applied side1 will be signed off\n'> <'\techo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&\n'> 
          <'\tgit cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&\n'> <'\ttest_cmp expected actual &&\n'> <'\n'> <'\t# Applied side2 will not be signed off\n'> 
          <'\ttest $(git cat-file commit HEAD | grep -c "Signed-off-by:") -eq 0\n'>
        )
      }
    )
    (C {<test_expect_success>} {<TTY>} {(SQ <'--reject overrides --no-reject'>)} 
      {
        (SQ <'\n'> <'\trm -fr .git/rebase-apply &&\n'> <'\tgit reset --hard &&\n'> 
          <'\tgit checkout first &&\n'> <'\trm -f file.rej &&\n'> <'\n'> <'\ttest_must_fail git am --no-reject side1.eml &&\n'> 
          <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\ttest_path_is_missing file.rej &&\n'> <'\n'> 
          <'\ttest_must_fail test_terminal git am --reject </dev/zero &&\n'> <'\ttest_path_is_dir .git/rebase-apply &&\n'> <'\ttest_path_is_file file.rej\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)