(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Test shallow cloning of repos with submodules'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:pwd)
          op: assign_op.Equal
          rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>}))}
          spids: [15]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tgit checkout -b master &&\n'> <'\ttest_commit commit1 &&\n'> 
          <'\ttest_commit commit2 &&\n'> <'\tmkdir sub &&\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit init &&\n'> 
          <'\t\ttest_commit subcommit1 &&\n'> <'\t\ttest_commit subcommit2 &&\n'> <'\t\ttest_commit subcommit3\n'> <'\t) &&\n'> 
          <'\tgit submodule add "file://$pwd/sub" sub &&\n'> <'\tgit commit -m "add submodule"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'nonshallow clone implies nonshallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <'\tgit clone --recurse-submodules "file://$pwd/." super_clone &&\n'> <'\tgit -C super_clone log --oneline >lines &&\n'> <'\ttest_line_count = 3 lines &&\n'> 
          <'\tgit -C super_clone/sub log --oneline >lines &&\n'> <'\ttest_line_count = 3 lines\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'shallow clone with shallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <
'\tgit clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&\n'
          > <'\tgit -C super_clone log --oneline >lines &&\n'> <'\ttest_line_count = 2 lines &&\n'> 
          <'\tgit -C super_clone/sub log --oneline >lines &&\n'> <'\ttest_line_count = 1 lines\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'shallow clone does not imply shallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <'\tgit clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&\n'> <'\tgit -C super_clone log --oneline >lines &&\n'> <'\ttest_line_count = 2 lines &&\n'> 
          <'\tgit -C super_clone/sub log --oneline >lines &&\n'> <'\ttest_line_count = 3 lines\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'shallow clone with non shallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <
'\tgit clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&\n'
          > <'\tgit -C super_clone log --oneline >lines &&\n'> <'\ttest_line_count = 2 lines &&\n'> 
          <'\tgit -C super_clone/sub log --oneline >lines &&\n'> <'\ttest_line_count = 3 lines\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'non shallow clone with shallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <
'\tgit clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&\n'
          > <'\tgit -C super_clone log --oneline >lines &&\n'> <'\ttest_line_count = 3 lines &&\n'> 
          <'\tgit -C super_clone/sub log --oneline >lines &&\n'> <'\ttest_line_count = 1 lines\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'clone follows shallow recommendation'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <'\tgit config -f .gitmodules submodule.sub.shallow true &&\n'> <'\tgit add .gitmodules &&\n'> <'\tgit commit -m "recommed shallow for sub" &&\n'> 
          <'\tgit clone --recurse-submodules --no-local "file://$pwd/." super_clone &&\n'> <'\t(\n'> <'\t\tcd super_clone &&\n'> <'\t\tgit log --oneline >lines &&\n'> 
          <'\t\ttest_line_count = 4 lines\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd super_clone/sub &&\n'> <'\t\tgit log --oneline >lines &&\n'> 
          <'\t\ttest_line_count = 1 lines\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'get unshallow recommended shallow submodule'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <'\tgit clone --no-local "file://$pwd/." super_clone &&\n'> <'\t(\n'> <'\t\tcd super_clone &&\n'> <'\t\tgit submodule update --init --no-recommend-shallow &&\n'> 
          <'\t\tgit log --oneline >lines &&\n'> <'\t\ttest_line_count = 4 lines\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd super_clone/sub &&\n'> 
          <'\t\tgit log --oneline >lines &&\n'> <'\t\ttest_line_count = 3 lines\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'clone follows non shallow recommendation'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "rm -rf super_clone" &&\n'> 
          <'\tgit config -f .gitmodules submodule.sub.shallow false &&\n'> <'\tgit add .gitmodules &&\n'> <'\tgit commit -m "recommed non shallow for sub" &&\n'> 
          <'\tgit clone --recurse-submodules --no-local "file://$pwd/." super_clone &&\n'> <'\t(\n'> <'\t\tcd super_clone &&\n'> <'\t\tgit log --oneline >lines &&\n'> 
          <'\t\ttest_line_count = 5 lines\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd super_clone/sub &&\n'> <'\t\tgit log --oneline >lines &&\n'> 
          <'\t\ttest_line_count = 3 lines\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)