(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <unpack-objects>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\tmkdir pub.git &&\n'> <'\tGIT_DIR=pub.git git init --bare &&\n'> 
          <'\tGIT_DIR=pub.git git config receive.fsckobjects true &&\n'> <'\tmkdir work &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit init &&\n'> 
          <'\t\tgit config push.default matching &&\n'> <'\t\tmkdir -p gar/bage &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> <'\t\t\tgit init &&\n'> 
          <'\t\t\tgit config push.default matching &&\n'> <'\t\t\t>junk &&\n'> <'\t\t\tgit add junk &&\n'> <'\t\t\tgit commit -m "Initial junk"\n'> <'\t\t) &&\n'> 
          <'\t\tgit add gar/bage &&\n'> <'\t\tgit commit -m "Initial superproject"\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {<push>} 
      {(SQ <'\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit push ../pub.git master\n'> <'\t)\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'push if submodule has no remote'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> <'\t\t>junk2 &&\n'> <'\t\tgit add junk2 &&\n'> 
          <'\t\tgit commit -m "Second junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <'\t\tgit commit -m "Second commit for gar/bage" &&\n'> <'\t\tgit push --recurse-submodules=check ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push fails if submodule commit not on remote'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar &&\n'> 
          <'\t\tgit clone --bare bage ../../submodule.git &&\n'> <'\t\tcd bage &&\n'> <'\t\tgit remote add origin ../../../submodule.git &&\n'> <'\t\tgit fetch &&\n'> 
          <'\t\t>junk3 &&\n'> <'\t\tgit add junk3 &&\n'> <'\t\tgit commit -m "Third junk"\n'> <'\t) &&\n'> <'\t(\n'> 
          <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> <'\t\tgit commit -m "Third commit for gar/bage" &&\n'> 
          <'\t\t# the push should fail with --recurse-submodules=check\n'> <'\t\t# on the command line...\n'> 
          <'\t\ttest_must_fail git push --recurse-submodules=check ../pub.git master &&\n'> <'\n'> <'\t\t# ...or if specified in the configuration..\n'> 
          <'\t\ttest_must_fail git -c push.recurseSubmodules=check push ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push succeeds after commit was pushed to remote'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> <'\t\tgit push origin master\n'> <'\t) &&\n'> 
          <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit push --recurse-submodules=check ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'push succeeds if submodule commit not on remote but using on-demand on command line'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-on-demand-on-command-line &&\n'> <'\t\tgit add recurse-on-demand-on-command-line &&\n'> 
          <'\t\tgit commit -m "Recurse on-demand on command line junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <'\t\tgit commit -m "Recurse on-demand on command line for gar/bage" &&\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master &&\n'> 
          <'\t\t# Check that the supermodule commit got there\n'> <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t# Check that the submodule commit got there too\n'> <'\t\tcd gar/bage &&\n'> <'\t\tgit diff --quiet origin/master master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'push succeeds if submodule commit not on remote but using on-demand from config'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> <'\t\t>recurse-on-demand-from-config &&\n'> 
          <'\t\tgit add recurse-on-demand-from-config &&\n'> <'\t\tgit commit -m "Recurse on-demand from config junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> 
          <'\t\tgit add gar/bage &&\n'> <'\t\tgit commit -m "Recurse on-demand from config for gar/bage" &&\n'> 
          <'\t\tgit -c push.recurseSubmodules=on-demand push ../pub.git master &&\n'> <'\t\t# Check that the supermodule commit got there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> <'\t\t# Check that the submodule commit got there too\n'> <'\t\tcd gar/bage &&\n'> 
          <'\t\tgit diff --quiet origin/master master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push recurse-submodules on command line overrides config'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-check-on-command-line-overriding-config &&\n'> <'\t\tgit add recurse-check-on-command-line-overriding-config &&\n'> 
          <'\t\tgit commit -m "Recurse on command-line overriding config junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <'\t\tgit commit -m "Recurse on command-line overriding config for gar/bage" &&\n'> <'\n'> <'\t\t# Ensure that we can override on-demand in the config\n'> 
          <'\t\t# to just check submodules\n'> 
          <
'\t\ttest_must_fail git -c push.recurseSubmodules=on-demand push --recurse-submodules=check ../pub.git master &&\n'
          > <'\t\t# Check that the supermodule commit did not get there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\tgit diff --quiet FETCH_HEAD master^ &&\n'> <'\t\t# Check that the submodule commit did not get there\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# Ensure that we can override check in the config to\n'> 
          <'\t\t# disable submodule recursion entirely\n'> <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> 
          <
'\t\tgit -c push.recurseSubmodules=on-demand push --recurse-submodules=no ../pub.git master &&\n'
          > <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# Ensure that we can override check in the config to\n'> 
          <'\t\t# disable submodule recursion entirely (alternative form)\n'> <'\t\tgit -c push.recurseSubmodules=on-demand push --no-recurse-submodules ../pub.git master &&\n'> 
          <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# Ensure that we can override check in the config to\n'> 
          <'\t\t# push the submodule too\n'> 
          <
'\t\tgit -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&\n'
          > <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master)\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push recurse-submodules last one wins on command line'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-check-on-command-line-overriding-earlier-command-line &&\n'> <'\t\tgit add recurse-check-on-command-line-overriding-earlier-command-line &&\n'> 
          <'\t\tgit commit -m "Recurse on command-line overridiing earlier command-line junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <
'\t\tgit commit -m "Recurse on command-line overriding earlier command-line for gar/bage" &&\n'
          > <'\n'> <'\t\t# should result in "check"\n'> 
          <
'\t\ttest_must_fail git push --recurse-submodules=on-demand --recurse-submodules=check ../pub.git master &&\n'
          > <'\t\t# Check that the supermodule commit did not get there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\tgit diff --quiet FETCH_HEAD master^ &&\n'> <'\t\t# Check that the submodule commit did not get there\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# should result in "no"\n'> 
          <
'\t\tgit push --recurse-submodules=on-demand --recurse-submodules=no ../pub.git master &&\n'
          > <'\t\t# Check that the supermodule commit did get there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> <'\t\t# Check that the submodule commit did not get there\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# should result in "no"\n'> 
          <
'\t\tgit push --recurse-submodules=on-demand --no-recurse-submodules ../pub.git master &&\n'
          > <'\t\t# Check that the submodule commit did not get there\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master^) &&\n'> <'\n'> <'\t\t# But the options in the other order should push the submodule\n'> 
          <
'\t\tgit push --recurse-submodules=check --recurse-submodules=on-demand ../pub.git master &&\n'
          > <'\t\t# Check that the submodule commit did get there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\t(cd gar/bage && git diff --quiet origin/master master)\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {
        (SQ 
          <
'push succeeds if submodule commit not on remote using on-demand from cmdline overriding config'
          >
        )
      } 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-on-demand-on-command-line-overriding-config &&\n'> <'\t\tgit add recurse-on-demand-on-command-line-overriding-config &&\n'> 
          <'\t\tgit commit -m "Recurse on-demand on command-line overriding config junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <
'\t\tgit commit -m "Recurse on-demand on command-line overriding config for gar/bage" &&\n'
          > 
          <
'\t\tgit -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&\n'
          > <'\t\t# Check that the supermodule commit got there\n'> <'\t\tgit fetch ../pub.git &&\n'> 
          <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> <'\t\t# Check that the submodule commit got there\n'> <'\t\tcd gar/bage &&\n'> 
          <'\t\tgit diff --quiet origin/master master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'push succeeds if submodule commit disabling recursion from cmdline overriding config'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-disable-on-command-line-overriding-config &&\n'> <'\t\tgit add recurse-disable-on-command-line-overriding-config &&\n'> 
          <'\t\tgit commit -m "Recurse disable on command-line overriding config junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <
'\t\tgit commit -m "Recurse disable on command-line overriding config for gar/bage" &&\n'
          > <'\t\tgit -c push.recurseSubmodules=check push --recurse-submodules=no ../pub.git master &&\n'> 
          <'\t\t# Check that the supermodule commit got there\n'> <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t# But that the submodule commit did not\n'> <'\t\t( cd gar/bage && git diff --quiet origin/master master^ ) &&\n'> 
          <'\t\t# Now push it to avoid confusing future tests\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {
        (SQ 
          <
'push succeeds if submodule commit disabling recursion from cmdline (alternative form) overriding config'
          >
        )
      } 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-disable-on-command-line-alt-overriding-config &&\n'> <'\t\tgit add recurse-disable-on-command-line-alt-overriding-config &&\n'> 
          <
'\t\tgit commit -m "Recurse disable on command-line alternative overriding config junk"\n'
          > <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <
'\t\tgit commit -m "Recurse disable on command-line alternative overriding config for gar/bage" &&\n'
          > <'\t\tgit -c push.recurseSubmodules=check push --no-recurse-submodules ../pub.git master &&\n'> 
          <'\t\t# Check that the supermodule commit got there\n'> <'\t\tgit fetch ../pub.git &&\n'> <'\t\tgit diff --quiet FETCH_HEAD master &&\n'> 
          <'\t\t# But that the submodule commit did not\n'> <'\t\t( cd gar/bage && git diff --quiet origin/master master^ ) &&\n'> 
          <'\t\t# Now push it to avoid confusing future tests\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push fails if recurse submodules option passed as yes'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> 
          <'\t\t>recurse-push-fails-if-recurse-submodules-passed-as-yes &&\n'> <'\t\tgit add recurse-push-fails-if-recurse-submodules-passed-as-yes &&\n'> 
          <'\t\tgit commit -m "Recurse push fails if recurse submodules option passed as yes"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <
'\t\tgit commit -m "Recurse push fails if recurse submodules option passed as yes for gar/bage" &&\n'
          > <'\t\ttest_must_fail git push --recurse-submodules=yes ../pub.git master &&\n'> 
          <'\t\ttest_must_fail git -c push.recurseSubmodules=yes push ../pub.git master &&\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'push fails when commit on multiple branches if one branch has no remote'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work/gar/bage &&\n'> <'\t\t>junk4 &&\n'> <'\t\tgit add junk4 &&\n'> 
          <'\t\tgit commit -m "Fourth junk"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\tgit branch branch2 &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <'\t\tgit commit -m "Fourth commit for gar/bage" &&\n'> <'\t\tgit checkout branch2 &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> <'\t\t\tgit checkout HEAD~1\n'> 
          <'\t\t) &&\n'> <'\t\t>junk1 &&\n'> <'\t\tgit add junk1 &&\n'> <'\t\tgit commit -m "First junk" &&\n'> 
          <'\t\ttest_must_fail git push --recurse-submodules=check ../pub.git\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'push succeeds if submodule has no remote and is on the first superproject commit'>)} 
      {
        (SQ <'\n'> <'\tgit init --bare a &&\n'> <'\tgit clone a a1 &&\n'> <'\t(\n'> <'\t\tcd a1 &&\n'> 
          <'\t\tgit init b\n'> <'\t\t(\n'> <'\t\t\tcd b &&\n'> <'\t\t\t>junk &&\n'> <'\t\t\tgit add junk &&\n'> 
          <'\t\t\tgit commit -m "initial"\n'> <'\t\t) &&\n'> <'\t\tgit add b &&\n'> <'\t\tgit commit -m "added submodule" &&\n'> 
          <'\t\tgit push --recurse-submodule=check origin master\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push unpushed submodules when not needed'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> 
          <'\t\t\tgit checkout master &&\n'> <'\t\t\t>junk5 &&\n'> <'\t\t\tgit add junk5 &&\n'> <'\t\t\tgit commit -m "Fifth junk" &&\n'> 
          <'\t\t\tgit push &&\n'> <'\t\t\tgit rev-parse origin/master >../../../expected\n'> <'\t\t) &&\n'> 
          <'\t\tgit checkout master &&\n'> <'\t\tgit add gar/bage &&\n'> <'\t\tgit commit -m "Fifth commit for gar/bage" &&\n'> 
          <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd submodule.git &&\n'> <'\t\tgit rev-parse master >../actual\n'> 
          <'\t) &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push unpushed submodules when not needed 2'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd submodule.git &&\n'> <'\t\tgit rev-parse master >../expected\n'> 
          <'\t) &&\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> <'\t\t\t>junk6 &&\n'> 
          <'\t\t\tgit add junk6 &&\n'> <'\t\t\tgit commit -m "Sixth junk"\n'> <'\t\t) &&\n'> <'\t\t>junk2 &&\n'> <'\t\tgit add junk2 &&\n'> 
          <'\t\tgit commit -m "Second junk for work" &&\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t) &&\n'> <'\t(\n'> 
          <'\t\tcd submodule.git &&\n'> <'\t\tgit rev-parse master >../actual\n'> <'\t) &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push unpushed submodules recursively'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> 
          <'\t\t\tgit checkout master &&\n'> <'\t\t\t> junk7 &&\n'> <'\t\t\tgit add junk7 &&\n'> <'\t\t\tgit commit -m "Seventh junk" &&\n'> 
          <'\t\t\tgit rev-parse master >../../../expected\n'> <'\t\t) &&\n'> <'\t\tgit checkout master &&\n'> <'\t\tgit add gar/bage &&\n'> 
          <'\t\tgit commit -m "Seventh commit for gar/bage" &&\n'> <'\t\tgit push --recurse-submodules=on-demand ../pub.git master\n'> <'\t) &&\n'> <'\t(\n'> 
          <'\t\tcd submodule.git &&\n'> <'\t\tgit rev-parse master >../actual\n'> <'\t) &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'push unpushable submodule recursively fails'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd work &&\n'> <'\t\t(\n'> <'\t\t\tcd gar/bage &&\n'> 
          <'\t\t\tgit rev-parse origin/master >../../../expected &&\n'> <'\t\t\tgit checkout master~0 &&\n'> <'\t\t\t> junk8 &&\n'> <'\t\t\tgit add junk8 &&\n'> 
          <'\t\t\tgit commit -m "Eighth junk"\n'> <'\t\t) &&\n'> <'\t\tgit add gar/bage &&\n'> <'\t\tgit commit -m "Eighth commit for gar/bage" &&\n'> 
          <'\t\ttest_must_fail git push --recurse-submodules=on-demand ../pub.git master\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd submodule.git &&\n'> <'\t\tgit rev-parse master >../actual\n'> 
          <'\t) &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)