(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git am handling submodules'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-submodule-update.sh'>})
    (command.ShFunction
      name: am
      body: 
        (BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {<git>} {<format-patch>} {<--stdout>} 
                  {<--ignore-submodules> <Id.Lit_Equals '='> <dirty>} {(DQ <..> ($ Id.VSub_Number '$1'))}
                )
                (C {<git>} {<am>} {<->})
              ]
              negated: F
            )
          ]
        )
    )
    (C {<test_submodule_switch>} {(DQ <am>)})
    (command.ShFunction
      name: am_3way
      body: 
        (BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {<git>} {<format-patch>} {<--stdout>} 
                  {<--ignore-submodules> <Id.Lit_Equals '='> <dirty>} {(DQ <..> ($ Id.VSub_Number '$1'))}
                )
                (C {<git>} {<am>} {<--3way>} {<->})
              ]
              negated: F
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: 
            (sh_lhs_expr.Name
              name: KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES
            )
          op: assign_op.Equal
          rhs: {<1>}
          spids: [99]
        )
      ]
    )
    (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.ShFunction
      name: run_test
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
              ]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:START_COMMIT)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$1')}
                      spids: [159]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:EXPECT)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$2')}
                      spids: [165]
                    )
                  ]
                )
                (C {<test_might_fail>} {<git>} {<am>} {<--abort>})
                (C {<git>} {<reset>} {<--hard>} {($ Id.VSub_DollarName '$START_COMMIT')})
                (C {<rm>} {<-f>} {<Id.Lit_Star '*'> <.patch>})
                (C {<git>} {<format-patch>} {<-1>})
                (C {<git>} {<reset>} {<--hard>} 
                  {($ Id.VSub_DollarName '$START_COMMIT') <Id.Lit_Other '^'>}
                )
                (C {<git>} {<submodule>} {<update>})
                (C {<git>} {<am>} {<Id.Lit_Star '*'> <.patch>})
                (C {<git>} {<submodule>} {<update>})
                (command.Simple
                  words: [{<git>} {<-C>} {<submodule>} {<rev-parse>} {<HEAD>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})]
                  do_fork: T
                )
                (C {<test_cmp>} {($ Id.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>})
  ]
)