(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'commit and log output encodings'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: compare_with
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.Pipeline
                  children: [
                    (C {<git>} {<show>} {<-s>} {($ Id.VSub_Number '$1')})
                    (command.Simple
                      words: [{<sed>} {<-e>} {(SQ <'1,/^$/d'>)} {<-e>} {(SQ <'s/^    //'>)}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<current>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  negated: F
                )
                (command.Case
                  to_match: {(DQ ($ Id.VSub_Number '$3'))}
                  arms: [
                    (case_arm
                      pat_list: [{(SQ )}]
                      action: [(C {<test_cmp>} {(DQ ($ Id.VSub_Number '$2'))} {<current>})]
                      spids: [71 73 84 -1]
                    )
                    (case_arm
                      pat_list: [{<Id.Lit_QMark '?'> <Id.Lit_Star '*'>}]
                      action: [
                        (command.AndOr
                          ops: [Id.Op_DAmp Id.Op_DAmp]
                          children: [
                            (command.Simple
                              words: [{<iconv>} {<-f>} {(DQ ($ Id.VSub_Number '$3'))} {<-t>} {<UTF-8>}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<current.utf8>}
                                )
                                (redir
                                  op: <Id.Redir_Less '<'>
                                  loc: (redir_loc.Fd fd:0)
                                  arg: {<current>}
                                )
                              ]
                              do_fork: T
                            )
                            (command.Simple
                              words: [{<iconv>} {<-f>} {(DQ ($ Id.VSub_Number '$3'))} {<-t>} {<UTF-8>}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<expect.utf8>}
                                )
                                (redir
                                  op: <Id.Redir_Less '<'>
                                  loc: (redir_loc.Fd fd:0)
                                  arg: {(DQ ($ Id.VSub_Number '$2'))}
                                )
                              ]
                              do_fork: T
                            )
                            (C {<test_cmp>} {<expect.utf8>} {<current.utf8>})
                          ]
                        )
                      ]
                      spids: [87 89 143 -1]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\t: >F &&\n'> <'\tgit add F &&\n'> <'\tT=$(git write-tree) &&\n'> 
          <'\tC=$(git commit-tree $T <"$TEST_DIRECTORY"/t3900/1-UTF-8.txt) &&\n'> <'\tgit update-ref HEAD $C &&\n'> <'\tgit tag C0\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'no encoding header for base case'>)} 
      {
        (SQ <'\n'> <'\tE=$(git cat-file commit C0 | sed -ne "s/^encoding //p") &&\n'> 
          <'\ttest z = "z$E"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'UTF-16 refused because of NULs'>)} 
      {
        (SQ <'\n'> <'\techo UTF-16 >F &&\n'> 
          <'\ttest_must_fail git commit -a -F "$TEST_DIRECTORY"/t3900/UTF-16.txt\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'UTF-8 invalid characters refused'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -f $HOME/stderr $HOME/invalid" &&\n'> 
          <'\techo "UTF-8 characters" >F &&\n'> <'\tprintf "Commit message\\n\\nInvalid surrogate:\\355\\240\\200\\n" \\\n'> 
          <'\t\t>"$HOME/invalid" &&\n'> <'\tgit commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&\n'> 
          <'\ttest_i18ngrep "did not conform" "$HOME"/stderr\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'UTF-8 overlong sequences rejected'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -f $HOME/stderr $HOME/invalid" &&\n'> 
          <'\trm -f "$HOME/stderr" "$HOME/invalid" &&\n'> <'\techo "UTF-8 overlong" >F &&\n'> 
          <'\tprintf "\\340\\202\\251ommit message\\n\\nThis is not a space:\\300\\240\\n" \\\n'> <'\t\t>"$HOME/invalid" &&\n'> <'\tgit commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&\n'> 
          <'\ttest_i18ngrep "did not conform" "$HOME"/stderr\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'UTF-8 non-characters refused'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -f $HOME/stderr $HOME/invalid" &&\n'> 
          <'\techo "UTF-8 non-character 1" >F &&\n'> <'\tprintf "Commit message\\n\\nNon-character:\\364\\217\\277\\276\\n" \\\n'> 
          <'\t\t>"$HOME/invalid" &&\n'> <'\tgit commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&\n'> 
          <'\ttest_i18ngrep "did not conform" "$HOME"/stderr\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'UTF-8 non-characters refused'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -f $HOME/stderr $HOME/invalid" &&\n'> 
          <'\techo "UTF-8 non-character 2." >F &&\n'> <'\tprintf "Commit message\\n\\nNon-character:\\357\\267\\220\\n" \\\n'> <'\t\t>"$HOME/invalid" &&\n'> 
          <'\tgit commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&\n'> <'\ttest_i18ngrep "did not conform" "$HOME"/stderr\n'>
        )
      }
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<ISO8859-1>} {<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} {(DQ ($ Id.VSub_DollarName '$H') <' setup'>)} 
              {
                (SQ <'\n'> <'\t\tgit config i18n.commitencoding $H &&\n'> 
                  <'\t\tgit checkout -b $H C0 &&\n'> <'\t\techo $H >F &&\n'> <'\t\tgit commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<ISO8859-1>} {<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} {(DQ <'check encoding header for '> ($ Id.VSub_DollarName '$H'))} 
              {(SQ <'\n'> <'\t\tE=$(git cat-file commit '>) ($ Id.VSub_DollarName '$H') 
                (SQ <' | sed -ne "s/^encoding //p") &&\n'> <'\t\ttest "z$E" = "z'>) ($ Id.VSub_DollarName '$H') (SQ <'"\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'config to remove customization'>)} 
      {
        (SQ <'\n'> <'\tgit config --unset-all i18n.commitencoding &&\n'> 
          <'\tif Z=$(git config --get-all i18n.commitencoding)\n'> <'\tthen\n'> <'\t\techo Oops, should have failed.\n'> <'\t\tfalse\n'> <'\telse\n'> 
          <'\t\ttest z = "z$Z"\n'> <'\tfi &&\n'> <'\tgit config i18n.commitencoding UTF-8\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ISO8859-1 should be shown in UTF-8 now'>)} 
      {(SQ <'\n'> <'\tcompare_with ISO8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt\n'>)}
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} 
              {(DQ ($ Id.VSub_DollarName '$H') <' should be shown in UTF-8 now'>)} 
              {(SQ <'\n'> <'\t\tcompare_with '>) ($ Id.VSub_DollarName '$H') 
                (SQ <' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'config to add customization'>)} 
      {
        (SQ <'\n'> <'\tgit config --unset-all i18n.commitencoding &&\n'> 
          <'\tif Z=$(git config --get-all i18n.commitencoding)\n'> <'\tthen\n'> <'\t\techo Oops, should have failed.\n'> <'\t\tfalse\n'> <'\telse\n'> 
          <'\t\ttest z = "z$Z"\n'> <'\tfi\n'>
        )
      }
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<ISO8859-1>} {<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} 
              {(DQ ($ Id.VSub_DollarName '$H') <' should be shown in itself now'>)} 
              {(SQ <'\n'> <'\t\tgit config i18n.commitencoding '>) ($ Id.VSub_DollarName '$H') 
                (SQ <' &&\n'> <'\t\tcompare_with '>) ($ Id.VSub_DollarName '$H') (SQ <' "$TEST_DIRECTORY"/t3900/'>) ($ Id.VSub_DollarName '$H') 
                (SQ <'.txt\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'config to tweak customization'>)} 
      {(SQ <'\n'> <'\tgit config i18n.logoutputencoding UTF-8\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'ISO8859-1 should be shown in UTF-8 now'>)} 
      {(SQ <'\n'> <'\tcompare_with ISO8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt\n'>)}
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} 
              {(DQ ($ Id.VSub_DollarName '$H') <' should be shown in UTF-8 now'>)} 
              {(SQ <'\n'> <'\t\tcompare_with '>) ($ Id.VSub_DollarName '$H') 
                (SQ <' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (command.ForEach
      iter_name: J
      iter_words: [{<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {<test>} {(DQ ($ Id.VSub_DollarName '$J'))} {<Id.Lit_Equals '='>} {<ISO-2022-JP>})
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:ICONV)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$J')}
                          spids: [549]
                        )
                      ]
                    )
                  ]
                  spids: [533 546]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:ICONV)
                      op: assign_op.Equal
                      rhs: (word.Empty)
                      spids: [556]
                    )
                  ]
                )
              ]
            )
            (C {<git>} {<config>} {<i18n.logoutputencoding>} {($ Id.VSub_DollarName '$J')})
            (command.ForEach
              iter_name: H
              iter_words: [{<eucJP>} {<ISO-2022-JP>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {<test_expect_success>} 
                      {
                        (DQ ($ Id.VSub_DollarName '$H') <' should be shown in '> 
                          ($ Id.VSub_DollarName '$J') <' now'>
                        )
                      } 
                      {(SQ <'\n'> <'\t\t\tcompare_with '>) ($ Id.VSub_DollarName '$H') 
                        (SQ <' "$TEST_DIRECTORY"/t3900/'>) ($ Id.VSub_DollarName '$J') (SQ <'.txt $ICONV\n'> <'\t\t'>)
                      }
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ForEach
      iter_name: H
      iter_words: [{<ISO8859-1>} {<eucJP>} {<ISO-2022-JP>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} {(DQ <'No conversion with '> ($ Id.VSub_DollarName '$H'))} 
              {(SQ <'\n'> <'\t\tcompare_with "--encoding=none '>) ($ Id.VSub_DollarName '$H') 
                (SQ <'" "$TEST_DIRECTORY"/t3900/'>) ($ Id.VSub_DollarName '$H') (SQ <'.txt\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_commit_autosquash_flags
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:H)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [661]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:flag)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [665]
                )
              ]
            )
            (C {<test_expect_success>} 
              {
                (DQ <'commit --'> ($ Id.VSub_DollarName '$flag') <' with '> ($ Id.VSub_DollarName '$H') 
                  <' encoding'>
                )
              } 
              {
                (SQ <'\n'> <'\t\tgit config i18n.commitencoding $H &&\n'> 
                  <'\t\tgit checkout -b $H-$flag C0 &&\n'> <'\t\techo $H >>F &&\n'> <'\t\tgit commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&\n'> 
                  <'\t\ttest_tick &&\n'> <'\t\techo intermediate stuff >>G &&\n'> <'\t\tgit add G &&\n'> 
                  <'\t\tgit commit -a -m "intermediate commit" &&\n'> <'\t\ttest_tick &&\n'> <'\t\techo $H $flag >>F &&\n'> <'\t\tgit commit -a --$flag HEAD~1 &&\n'> 
                  <'\t\tE=$(git cat-file commit '>
                ) ($ Id.VSub_DollarName '$H') <-> ($ Id.VSub_DollarName '$flag') 
                (SQ <' |\n'> <'\t\t\tsed -ne "s/^encoding //p") &&\n'> <'\t\ttest "z$E" = "z$H" &&\n'> 
                  <'\t\tgit config --unset-all i18n.commitencoding &&\n'> <'\t\tgit rebase --autosquash -i HEAD^^^ &&\n'> <'\t\tgit log --oneline >actual &&\n'> 
                  <'\t\ttest_line_count = 3 actual\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {<test_commit_autosquash_flags>} {<eucJP>} {<fixup>})
    (C {<test_commit_autosquash_flags>} {<ISO-2022-JP>} {<squash>})
    (C {<test_done>})
  ]
)