(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git am handling submodules'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/lib-submodule-update.sh)})
    (command.FuncDef
      name: am
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(git)} {(format-patch)} {(--stdout)} {(--ignore-submodules) (Lit_Other '=') (dirty)} 
                  {(DQ (..) ($ VSub_Number '$1'))}
                )
                (C {(git)} {(am)} {(-)})
              ]
              negated: F
            )
          ]
        )
    )
    (C {(test_submodule_switch)} {(DQ (am))})
    (command.FuncDef
      name: am_3way
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(git)} {(format-patch)} {(--stdout)} {(--ignore-submodules) (Lit_Other '=') (dirty)} 
                  {(DQ (..) ($ VSub_Number '$1'))}
                )
                (C {(git)} {(am)} {(--3way)} {(-)})
              ]
              negated: F
            )
          ]
        )
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: 
            (lhs_expr.LhsName
              name: KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES
            )
          op: Equal
          rhs: {(1)}
        )
      ]
    )
    (C {(test_submodule_switch)} {(DQ (am_3way))})
    (C {(test_expect_success)} {(SQ <'setup diff.submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_commit one &&\n'> <'\tINITIAL=$(git rev-parse HEAD) &&\n'> <'\n'> 
          <'\tgit init submodule &&\n'> <'\t(\n'> <'\t\tcd submodule &&\n'> <'\t\ttest_commit two &&\n'> 
          <'\t\tgit rev-parse HEAD >../initial-submodule\n'> <'\t) &&\n'> <'\tgit submodule add ./submodule &&\n'> <'\tgit commit -m first &&\n'> <'\n'> <'\t(\n'> 
          <'\t\tcd submodule &&\n'> <'\t\ttest_commit three &&\n'> <'\t\tgit rev-parse HEAD >../first-submodule\n'> <'\t) &&\n'> 
          <'\tgit add submodule &&\n'> <'\tgit commit -m second &&\n'> <'\tSECOND=$(git rev-parse HEAD) &&\n'> <'\n'> <'\t(\n'> 
          <'\t\tcd submodule &&\n'> <'\t\tgit mv two.t four.t &&\n'> <'\t\tgit commit -m "second submodule" &&\n'> 
          <'\t\tgit rev-parse HEAD >../second-submodule\n'> <'\t) &&\n'> <'\ttest_commit four &&\n'> <'\tgit add submodule &&\n'> 
          <'\tgit commit --amend --no-edit &&\n'> <'\tTHIRD=$(git rev-parse HEAD) &&\n'> <'\tgit submodule update --init\n'>
        )
      }
    )
    (command.FuncDef
      name: run_test
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:START_COMMIT)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                    )
                  ]
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:EXPECT)
                      op: Equal
                      rhs: {($ VSub_Number '$2')}
                    )
                  ]
                )
                (C {(test_might_fail)} {(git)} {(am)} {(--abort)})
                (C {(git)} {(reset)} {(--hard)} {($ VSub_DollarName '$START_COMMIT')})
                (C {(rm)} {(-f)} {(Lit_Other '*') (.patch)})
                (C {(git)} {(format-patch)} {(-1)})
                (C {(git)} {(reset)} {(--hard)} {($ VSub_DollarName '$START_COMMIT') (Lit_Other '^')})
                (C {(git)} {(submodule)} {(update)})
                (C {(git)} {(am)} {(Lit_Other '*') (.patch)})
                (C {(git)} {(submodule)} {(update)})
                (command.SimpleCommand
                  words: [{(git)} {(-C)} {(submodule)} {(rev-parse)} {(HEAD)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})]
                )
                (C {(test_cmp)} {($ VSub_DollarName '$EXPECT')} {(actual)})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ <'diff.submodule unset'>)} 
      {(SQ <'\n'> <'\ttest_unconfig diff.submodule &&\n'> <'\trun_test $SECOND first-submodule\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'diff.submodule unset with extra file'>)} 
      {(SQ <'\n'> <'\ttest_unconfig diff.submodule &&\n'> <'\trun_test $THIRD second-submodule\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'diff.submodule=log'>)} 
      {(SQ <'\n'> <'\ttest_config diff.submodule log &&\n'> <'\trun_test $SECOND first-submodule\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'diff.submodule=log with extra file'>)} 
      {(SQ <'\n'> <'\ttest_config diff.submodule log &&\n'> <'\trun_test $THIRD second-submodule\n'>)}
    )
    (C {(test_done)})
  ]
)