(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <'Support for verbose submodule differences in git diff\n'> <'\n'> 
                <'This test tries to verify the sanity of the --submodule option of git diff.\n'>
              )
            }
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:test_encoding) op:Equal rhs:{(DQ (ISO8859-1))})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:added)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(printf)} {(DQ (hinzugef) (Lit_Other '\\') (303) (Lit_Other '\\') (274gt))})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (command.FuncDef
      name: add_file
      body: 
        (command.BraceGroup
          children: [
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp Op_DAmp]
                      children: [
                        (C {(cd)} {(DQ ($ VSub_Number '$1'))})
                        (C {(shift)})
                        (command.ForEach
                          iter_name: name
                          do_arg_iter: T
                          body: 
                            (command.DoGroup
                              children: [
                                (command.AndOr
                                  ops: [Op_DAmp Op_DAmp Op_DAmp]
                                  children: [
                                    (command.SimpleCommand
                                      words: [{(echo)} {(DQ ($ VSub_DollarName '$name'))}]
                                      redirects: [
                                        (redir.Redir
                                          op: <Redir_Great '>'>
                                          fd: 16777215
                                          arg_word: {(DQ ($ VSub_DollarName '$name'))}
                                        )
                                      ]
                                    )
                                    (C {(git)} {(add)} {(DQ ($ VSub_DollarName '$name'))})
                                    (C {(test_tick)})
                                    (command.Pipeline
                                      children: [
                                        (C {(echo)} 
                                          {
                                            (DQ ('Add ') ($ VSub_DollarName '$name') (' (') 
                                              ($ VSub_DollarName '$added') (' ') ($ VSub_DollarName '$name') (')')
                                            )
                                          }
                                        )
                                        (C {(iconv)} {(-f)} {(utf-8)} {(-t)} 
                                          {($ VSub_DollarName '$test_encoding')}
                                        )
                                        (C {(git)} {(-c)} 
                                          {
                                            (DQ ('i18n.commitEncoding=') 
                                              ($ VSub_DollarName '$test_encoding')
                                            )
                                          } {(commit)} {(-F)} {(-)}
                                        )
                                      ]
                                      negated: F
                                    )
                                  ]
                                )
                              ]
                            )
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(/dev/null)}
                            )
                          ]
                        )
                        (C {(git)} {(rev-parse)} {(--short)} {(--verify)} {(HEAD)})
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.FuncDef
      name: commit_file
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(test_tick)})
                (command.SimpleCommand
                  words: [
                    {(git)}
                    {(commit)}
                    {(DQ ($ VSub_At '$@'))}
                    {(-m)}
                    {(DQ ('Commit ') ($ VSub_Star '$*'))}
                  ]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
                )
              ]
            )
          ]
        )
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(test_create_repo)} {(sm1)})
        (command.SimpleCommand
          words: [{(add_file)} {(.)} {(foo)}]
          redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:head1)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [(C {(add_file)} {(sm1)} {(foo1)} {(foo2)})]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:fullhead1)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Sentence
                        child: (C {(cd)} {(sm1)})
                        terminator: <Op_Semi ';'>
                      )
                      (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'added submodule'>)} 
      {
        (SQ <'\n'> <'\tgit add sm1 &&\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 0000000...$head1 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'added submodule, set diff.submodule'>)} 
      {
        (SQ <'\n'> <'\tgit config diff.submodule log &&\n'> <'\tgit add sm1 &&\n'> 
          <'\tgit diff --cached >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 0000000...$head1 (new submodule)\n'> <'\tEOF\n'> 
          <'\tgit config --unset diff.submodule &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'--submodule=short overrides diff.submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_config diff.submodule log &&\n'> <'\tgit add sm1 &&\n'> 
          <'\tgit diff --submodule=short --cached >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tdiff --git a/sm1 b/sm1\n'> <'\tnew file mode 160000\n'> 
          <'\tindex 0000000..$head1\n'> <'\t--- /dev/null\n'> <'\t+++ b/sm1\n'> <'\t@@ -0,0 +1 @@\n'> <'\t+Subproject commit $fullhead1\n'> 
          <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'diff.submodule does not affect plumbing'>)} 
      {
        (SQ <'\n'> <'\ttest_config diff.submodule log &&\n'> <'\tgit diff-index -p HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tdiff --git a/sm1 b/sm1\n'> <'\tnew file mode 160000\n'> <'\tindex 0000000..$head1\n'> 
          <'\t--- /dev/null\n'> <'\t+++ b/sm1\n'> <'\t@@ -0,0 +1 @@\n'> <'\t+Subproject commit $fullhead1\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(commit_file)} {(sm1)})
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head2)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: (command.CommandList children:[(C {(add_file)} {(sm1)} {(foo3)})])
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(forward)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head1..$head2:\n'> <'\t  > Add foo3 ($added foo3)\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(forward)'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule=log >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tSubmodule sm1 $head1..$head2:\n'> <'\t  > Add foo3 ($added foo3)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(forward) --submodule'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tSubmodule sm1 $head1..$head2:\n'> <'\t  > Add foo3 ($added foo3)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:fullhead2)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Sentence
                        child: (C {(cd)} {(sm1)})
                        terminator: <Op_Semi ';'>
                      )
                      (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(forward) --submodule=short'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule=short >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tdiff --git a/sm1 b/sm1\n'> <'\tindex $head1..$head2 160000\n'> <'\t--- a/sm1\n'> <'\t+++ b/sm1\n'> <'\t@@ -1 +1 @@\n'> 
          <'\t-Subproject commit $fullhead1\n'> <'\t+Subproject commit $fullhead2\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(commit_file)} {(sm1)})
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head3)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.AndOr
                            ops: [Op_DAmp Op_DAmp]
                            children: [
                              (C {(cd)} {(sm1)})
                              (command.SimpleCommand
                                words: [{(git)} {(reset)} {(--hard)} {(HEAD) (Lit_TildeLike '~2')}]
                                redirects: [
                                  (redir.Redir
                                    op: <Redir_Great '>'>
                                    fd: 16777215
                                    arg_word: {(/dev/null)}
                                  )
                                ]
                              )
                              (C {(git)} {(rev-parse)} {(--short)} {(--verify)} {(HEAD)})
                            ]
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(backward)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head2..$head3 (rewind):\n'> <'\t  < Add foo3 ($added foo3)\n'> 
          <'\t  < Add foo2 ($added foo2)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:head4)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [(C {(add_file)} {(sm1)} {(foo4)} {(foo5)})]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'modified submodule(backward and forward)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head2...$head4:\n'> <'\t  > Add foo5 ($added foo5)\n'> 
          <'\t  > Add foo4 ($added foo4)\n'> <'\t  < Add foo3 ($added foo3)\n'> <'\t  < Add foo2 ($added foo2)\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
      children: [
        (C {(commit_file)} {(sm1)})
        (C {(mv)} {(sm1)} {(sm1-bak)})
        (command.SimpleCommand
          words: [{(echo)} {(sm1)}]
          redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(sm1)})]
        )
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head5)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.Pipeline
                            children: [(C {(git)} {(hash-object)} {(sm1)}) (C {(cut)} {(-c1-7)})]
                            negated: F
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
        (C {(git)} {(add)} {(sm1)})
        (C {(rm)} {(-f)} {(sm1)})
        (C {(mv)} {(sm1-bak)} {(sm1)})
      ]
    )
    (C {(test_expect_success)} {(SQ <'typechanged submodule(submodule->blob), --cached'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule=log --cached >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tSubmodule sm1 $head4...0000000 (submodule deleted)\n'> <'\tdiff --git a/sm1 b/sm1\n'> <'\tnew file mode 100644\n'> <'\tindex 0000000..$head5\n'> 
          <'\t--- /dev/null\n'> <'\t+++ b/sm1\n'> <'\t@@ -0,0 +1 @@\n'> <'\t+sm1\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'typechanged submodule(submodule->blob)'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule=log >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tdiff --git a/sm1 b/sm1\n'> <'\tdeleted file mode 100644\n'> <'\tindex $head5..0000000\n'> <'\t--- a/sm1\n'> <'\t+++ /dev/null\n'> 
          <'\t@@ -1 +0,0 @@\n'> <'\t-sm1\n'> <'\tSubmodule sm1 0000000...$head4 (new submodule)\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [(C {(rm)} {(-rf)} {(sm1)}) (C {(git)} {(checkout-index)} {(sm1)})]
    )
    (C {(test_expect_success)} {(SQ <'typechanged submodule(submodule->blob)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head4...0000000 (submodule deleted)\n'> <'\tdiff --git a/sm1 b/sm1\n'> 
          <'\tnew file mode 100644\n'> <'\tindex 0000000..$head5\n'> <'\t--- /dev/null\n'> <'\t+++ b/sm1\n'> <'\t@@ -0,0 +1 @@\n'> <'\t+sm1\n'> 
          <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp Op_DAmp]
      children: [
        (C {(rm)} {(-f)} {(sm1)})
        (C {(test_create_repo)} {(sm1)})
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head6)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [(C {(add_file)} {(sm1)} {(foo6)} {(foo7)})]
                      )
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:fullhead6)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Sentence
                        child: (C {(cd)} {(sm1)})
                        terminator: <Op_Semi ';'>
                      )
                      (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'nonexistent commit'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head4...$head6 (commits not present)\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(commit_file)})
    (C {(test_expect_success)} {(SQ <'typechanged submodule(blob->submodule)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tdiff --git a/sm1 b/sm1\n'> <'\tdeleted file mode 100644\n'> <'\tindex $head5..0000000\n'> 
          <'\t--- a/sm1\n'> <'\t+++ /dev/null\n'> <'\t@@ -1 +0,0 @@\n'> <'\t-sm1\n'> 
          <'\tSubmodule sm1 0000000...$head6 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(commit_file)} {(sm1)})
        (C {(test_expect_success)} {(SQ <'submodule is up to date'>)} 
          {
            (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
              <'\tcat >expected <<-EOF &&\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
            )
          }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked content'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/new-file &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains untracked content\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked content (untracked ignored)'>)} 
      {
        (SQ <'\n'> 
          <'\tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n'> <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked content (dirty ignored)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n'> 
          <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked content (all ignored)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&\n'> 
          <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked and modifed content'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains untracked content\n'> 
          <'\tSubmodule sm1 contains modified content\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'submodule contains untracked and modifed content (untracked ignored)'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains modified content\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'submodule contains untracked and modifed content (dirty ignored)'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n'> <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains untracked and modifed content (all ignored)'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules --submodule=log HEAD >actual &&\n'> <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'submodule contains modifed content'>)} 
      {
        (SQ <'\n'> <'\trm -f sm1/new-file &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains modified content\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp Op_DAmp]
      children: [
        (command.Subshell
          command_list: 
            (command.CommandList
              children: [
                (command.Sentence child:(C {(cd)} {(sm1)}) terminator:<Op_Semi ';'>)
                (command.SimpleCommand
                  words: [{(git)} {(commit)} {(-mchange)} {(foo6)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
                )
              ]
            )
        )
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head8)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.Sentence
                            child: (C {(cd)} {(sm1)})
                            terminator: <Op_Semi ';'>
                          )
                          (C {(git)} {(rev-parse)} {(--short)} {(--verify)} {(HEAD)})
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
        (C {(test_expect_success)} {(SQ <'submodule is modified'>)} 
          {
            (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
              <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
            )
          }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'modified submodule contains untracked content'>)} 
      {
        (SQ <'\n'> <'\techo new > sm1/new-file &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains untracked content\n'> 
          <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'modified submodule contains untracked content (untracked ignored)'>)} 
      {
        (SQ <'\n'> 
          <'\tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule contains untracked content (dirty ignored)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule contains untracked content (all ignored)'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&\n'> 
          <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule contains untracked and modifed content'>)} 
      {
        (SQ <'\n'> <'\techo modification >> sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains untracked content\n'> 
          <'\tSubmodule sm1 contains modified content\n'> <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'modified submodule contains untracked and modifed content (untracked ignored)'>)} 
      {
        (SQ <'\n'> <'\techo modification >> sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains modified content\n'> 
          <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'modified submodule contains untracked and modifed content (dirty ignored)'>)} 
      {
        (SQ <'\n'> <'\techo modification >> sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'modified submodule contains untracked and modifed content (all ignored)'>)} 
      {
        (SQ <'\n'> <'\techo modification >> sm1/foo6 &&\n'> 
          <'\tgit diff-index -p --ignore-submodules --submodule=log HEAD >actual &&\n'> <'\t! test -s actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'modified submodule contains modifed content'>)} 
      {
        (SQ <'\n'> <'\trm -f sm1/new-file &&\n'> 
          <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 contains modified content\n'> 
          <'\tSubmodule sm1 $head6..$head8:\n'> <'\t  > change\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(rm)} {(-rf)} {(sm1)})
    (C {(test_expect_success)} {(SQ <'deleted submodule'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6...0000000 (submodule deleted)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.AndOr
      ops: [Op_DAmp Op_DAmp]
      children: [
        (C {(test_create_repo)} {(sm2)})
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:head7)
              op: Equal
              rhs: 
                {
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [(C {(add_file)} {(sm2)} {(foo8)} {(foo9)})]
                      )
                    left_token: <Left_CommandSub '$('>
                  )
                }
            )
          ]
        )
        (C {(git)} {(add)} {(sm2)})
      ]
    )
    (C {(test_expect_success)} {(SQ <'multiple submodules'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6...0000000 (submodule deleted)\n'> 
          <'\tSubmodule sm2 0000000...$head7 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'path filter'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD sm2 >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm2 0000000...$head7 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(commit_file)} {(sm2)})
    (C {(test_expect_success)} {(SQ <'given commit'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=log HEAD^ >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6...0000000 (submodule deleted)\n'> 
          <'\tSubmodule sm2 0000000...$head7 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'given commit --submodule'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule HEAD^ >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $head6...0000000 (submodule deleted)\n'> 
          <'\tSubmodule sm2 0000000...$head7 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:fullhead7)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Sentence
                        child: (C {(cd)} {(sm2)})
                        terminator: <Op_Semi ';'>
                      )
                      (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'given commit --submodule=short'>)} 
      {
        (SQ <'\n'> <'\tgit diff-index -p --submodule=short HEAD^ >actual &&\n'> 
          <'\tcat >expected <<-EOF &&\n'> <'\tdiff --git a/sm1 b/sm1\n'> <'\tdeleted file mode 160000\n'> <'\tindex $head6..0000000\n'> 
          <'\t--- a/sm1\n'> <'\t+++ /dev/null\n'> <'\t@@ -1 +0,0 @@\n'> <'\t-Subproject commit $fullhead6\n'> 
          <'\tdiff --git a/sm2 b/sm2\n'> <'\tnew file mode 160000\n'> <'\tindex 0000000..$head7\n'> <'\t--- /dev/null\n'> <'\t+++ b/sm2\n'> 
          <'\t@@ -0,0 +1 @@\n'> <'\t+Subproject commit $fullhead7\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'setup .git file for sm2'>)} 
      {
        (SQ <'\n'> <'\t(cd sm2 &&\n'> <'\t REAL="$(pwd)/../.real" &&\n'> <'\t mv .git "$REAL"\n'> 
          <'\t echo "gitdir: $REAL" >.git)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'diff --submodule with .git file'>)} 
      {
        (SQ <'\n'> <'\tgit diff --submodule HEAD^ >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> 
          <'\tSubmodule sm1 $head6...0000000 (submodule deleted)\n'> <'\tSubmodule sm2 0000000...$head7 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'diff --submodule with objects referenced by alternates'>)} 
      {
        (SQ <'\n'> <'\tmkdir sub_alt &&\n'> <'\t(cd sub_alt &&\n'> <'\t\tgit init &&\n'> 
          <'\t\techo a >a &&\n'> <'\t\tgit add a &&\n'> <'\t\tgit commit -m a\n'> <'\t) &&\n'> <'\tmkdir super &&\n'> <'\t(cd super &&\n'> 
          <'\t\tgit clone -s ../sub_alt sub &&\n'> <'\t\tgit init &&\n'> <'\t\tgit add sub &&\n'> <'\t\tgit commit -m "sub a"\n'> <'\t) &&\n'> 
          <'\t(cd sub_alt &&\n'> <'\t\tsha1_before=$(git rev-parse --short HEAD)\n'> <'\t\techo b >b &&\n'> <'\t\tgit add b &&\n'> 
          <'\t\tgit commit -m b &&\n'> <'\t\tsha1_after=$(git rev-parse --short HEAD) &&\n'> <'\t\t{\n'> 
          <'\t\t\techo "Submodule sub $sha1_before..$sha1_after:" &&\n'> <'\t\t\techo "  > b"\n'> <'\t\t} >../expected\n'> <'\t) &&\n'> <'\t(cd super &&\n'> <'\t\t(cd sub &&\n'> 
          <'\t\t\tgit fetch &&\n'> <'\t\t\tgit checkout origin/master\n'> <'\t\t) &&\n'> <'\t\tgit diff --submodule > ../actual\n'> 
          <'\t) &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)