(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:test_description) op:Equal rhs:{(clone)})]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:X) op:Equal rhs:(word.EmptyWord))]
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(test_have_prereq)} {(KW_Bang '!') (MINGW)})
        (command.Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(lhs_expr.LhsName name:X) op:Equal rhs:{(.exe)})]
        )
      ]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -fr .git &&\n'> <'\ttest_create_repo src &&\n'> <'\t(\n'> 
          <'\t\tcd src &&\n'> <'\t\t>file &&\n'> <'\t\tgit add file &&\n'> <'\t\tgit commit -m initial &&\n'> 
          <'\t\techo 1 >file &&\n'> <'\t\tgit add file &&\n'> <'\t\tgit commit -m updated\n'> <'\t)\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone with excess parameters (1)'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -fr dst &&\n'> <'\ttest_must_fail git clone -n src dst junk\n'> <'\n'>)
      }
    )
    (C {(test_expect_success)} {(SQ <'clone with excess parameters (2)'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -fr dst &&\n'> 
          <'\ttest_must_fail git clone -n "file://$(pwd)/src" dst junk\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(C_LOCALE_OUTPUT)} {(SQ <'output from clone'>)} 
      {
        (SQ <'\n'> <'\trm -fr dst &&\n'> <'\tgit clone -n "file://$(pwd)/src" dst >output 2>&1 &&\n'> 
          <'\ttest $(grep Clon output | wc -l) = 1\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone does not keep pack'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -fr dst &&\n'> <'\tgit clone -n "file://$(pwd)/src" dst &&\n'> 
          <'\t! test -f dst/file &&\n'> <'\t! (echo dst/.git/objects/pack/pack-* | grep "\\.keep")\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone checks out files'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -fr dst &&\n'> <'\tgit clone src dst &&\n'> <'\ttest -f dst/file\n'> 
          <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone respects GIT_WORK_TREE'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tGIT_WORK_TREE=worktree git clone src bare &&\n'> 
          <'\ttest -f bare/config &&\n'> <'\ttest -f worktree/file\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone from hooks'>)} 
      {
        (SQ <'\n'> <'\n'> <'\ttest_create_repo r0 &&\n'> <'\tcd r0 &&\n'> <'\ttest_commit initial &&\n'> 
          <'\tcd .. &&\n'> <'\tgit init r1 &&\n'> <'\tcd r1 &&\n'> <'\tcat >.git/hooks/pre-commit <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> 
          <'\tgit clone ../r0 ../r2\n'> <'\texit 1\n'> <'\tEOF\n'> <'\tchmod u+x .git/hooks/pre-commit &&\n'> <'\t: >file &&\n'> 
          <'\tgit add file &&\n'> <'\ttest_must_fail git commit -m invoke-hook &&\n'> <'\tcd .. &&\n'> 
          <'\ttest_cmp r0/.git/HEAD r2/.git/HEAD &&\n'> <'\ttest_cmp r0/initial.t r2/initial.t\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone creates intermediate directories'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit clone src long/path/to/dst &&\n'> 
          <'\ttest -f long/path/to/dst/file\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone creates intermediate directories for bare repo'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit clone --bare src long/path/to/bare/dst &&\n'> 
          <'\ttest -f long/path/to/bare/dst/config\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone --mirror'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit clone --mirror src mirror &&\n'> <'\ttest -f mirror/HEAD &&\n'> 
          <'\ttest ! -f mirror/file &&\n'> <'\tFETCH="$(cd mirror && git config remote.origin.fetch)" &&\n'> 
          <'\ttest "+refs/*:refs/*" = "$FETCH" &&\n'> <'\tMIRROR="$(cd mirror && git config --bool remote.origin.mirror)" &&\n'> 
          <'\ttest "$MIRROR" = true\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone --mirror with detached HEAD'>)} 
      {
        (SQ <'\n'> <'\n'> 
          <'\t( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&\n'> <'\tgit clone --mirror src mirror.detached &&\n'> <'\t( cd src && git checkout - ) &&\n'> 
          <'\tGIT_DIR=mirror.detached git rev-parse HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone --bare with detached HEAD'>)} 
      {
        (SQ <'\n'> <'\n'> 
          <'\t( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&\n'> <'\tgit clone --bare src bare.detached &&\n'> <'\t( cd src && git checkout - ) &&\n'> 
          <'\tGIT_DIR=bare.detached git rev-parse HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone --bare names the local repository <name>.git'>)} 
      {(SQ <'\n'> <'\n'> <'\tgit clone --bare src &&\n'> <'\ttest -d src.git\n'> <'\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'clone --mirror does not repeat tags'>)} 
      {
        (SQ <'\n'> <'\n'> <'\t(cd src &&\n'> <'\t git tag some-tag HEAD) &&\n'> 
          <'\tgit clone --mirror src mirror2 &&\n'> <'\t(cd mirror2 &&\n'> <'\t git show-ref 2> clone.err > clone.out) &&\n'> 
          <'\ttest_must_fail grep Duplicate mirror2/clone.err &&\n'> <'\tgrep some-tag mirror2/clone.out\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone to destination with trailing /'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit clone src target-1/ &&\n'> 
          <'\tT=$( cd target-1 && git rev-parse HEAD ) &&\n'> <'\tS=$( cd src && git rev-parse HEAD ) &&\n'> <'\ttest "$T" = "$S"\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone to destination with extra trailing /'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit clone src target-2/// &&\n'> 
          <'\tT=$( cd target-2 && git rev-parse HEAD ) &&\n'> <'\tS=$( cd src && git rev-parse HEAD ) &&\n'> <'\ttest "$T" = "$S"\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone to an existing empty directory'>)} 
      {
        (SQ <'\n'> <'\tmkdir target-3 &&\n'> <'\tgit clone src target-3 &&\n'> 
          <'\tT=$( cd target-3 && git rev-parse HEAD ) &&\n'> <'\tS=$( cd src && git rev-parse HEAD ) &&\n'> <'\ttest "$T" = "$S"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone to an existing non-empty directory'>)} 
      {
        (SQ <'\n'> <'\tmkdir target-4 &&\n'> <'\t>target-4/Fakefile &&\n'> 
          <'\ttest_must_fail git clone src target-4\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone to an existing path'>)} 
      {(SQ <'\n'> <'\t>target-5 &&\n'> <'\ttest_must_fail git clone src target-5\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'clone a void'>)} 
      {
        (SQ <'\n'> <'\tmkdir src-0 &&\n'> <'\t(\n'> <'\t\tcd src-0 && git init\n'> <'\t) &&\n'> 
          <'\tgit clone "file://$(pwd)/src-0" target-6 2>err-6 &&\n'> <'\t! grep "fatal:" err-6 &&\n'> <'\t(\n'> <'\t\tcd src-0 && test_commit A\n'> <'\t) &&\n'> 
          <'\tgit clone "file://$(pwd)/src-0" target-7 2>err-7 &&\n'> <'\t! grep "fatal:" err-7 &&\n'> <'\t# There is no reason to insist they are bit-for-bit\n'> 
          <'\t# identical, but this test should suffice for now.\n'> <'\ttest_cmp target-6/.git/config target-7/.git/config\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone respects global branch.autosetuprebase'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\ttest_config="$HOME/.gitconfig" &&\n'> 
          <'\t\tgit config -f "$test_config" branch.autosetuprebase remote &&\n'> <'\t\trm -fr dst &&\n'> <'\t\tgit clone src dst &&\n'> <'\t\tcd dst &&\n'> 
          <'\t\tactual="z$(git config branch.master.rebase)" &&\n'> <'\t\ttest ztrue = $actual\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'respect url-encoding of file://'>)} 
      {
        (SQ <'\n'> <'\tgit init x+y &&\n'> <'\tgit clone "file://$PWD/x+y" xy-url-1 &&\n'> 
          <'\tgit clone "file://$PWD/x%2By" xy-url-2\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'do not query-string-decode + in URLs'>)} 
      {
        (SQ <'\n'> <'\trm -rf x+y &&\n'> <'\tgit init "x y" &&\n'> 
          <'\ttest_must_fail git clone "file://$PWD/x+y" xy-no-plus\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'do not respect url-encoding of non-url path'>)} 
      {
        (SQ <'\n'> <'\tgit init x+y &&\n'> <'\ttest_must_fail git clone x%2By xy-regular &&\n'> 
          <'\tgit clone x+y xy-regular\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone separate gitdir'>)} 
      {
        (SQ <'\n'> <'\trm -rf dst &&\n'> <'\tgit clone --separate-git-dir realgitdir src dst &&\n'> 
          <'\ttest -d realgitdir/refs\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone separate gitdir: output'>)} 
      {
        (SQ <'\n'> <'\techo "gitdir: $(pwd)/realgitdir" >expected &&\n'> 
          <'\ttest_cmp expected dst/.git\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone from .git file'>)} 
      {(SQ <'\n'> <'\tgit clone dst/.git dst2\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'fetch from .git gitfile'>)} 
      {(SQ <'\n'> <'\t(\n'> <'\t\tcd dst2 &&\n'> <'\t\tgit fetch ../dst/.git\n'> <'\t)\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'fetch from gitfile parent'>)} 
      {(SQ <'\n'> <'\t(\n'> <'\t\tcd dst2 &&\n'> <'\t\tgit fetch ../dst\n'> <'\t)\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'clone separate gitdir where target already exists'>)} 
      {
        (SQ <'\n'> <'\trm -rf dst &&\n'> 
          <'\ttest_must_fail git clone --separate-git-dir realgitdir src dst\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone --reference from original'>)} 
      {
        (SQ <'\n'> <'\tgit clone --shared --bare src src-1 &&\n'> <'\tgit clone --bare src src-2 &&\n'> 
          <'\tgit clone --reference=src-2 --bare src-1 target-8 &&\n'> <'\tgrep /src-2/ target-8/objects/info/alternates\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone with more than one --reference'>)} 
      {
        (SQ <'\n'> <'\tgit clone --bare src src-3 &&\n'> <'\tgit clone --bare src src-4 &&\n'> 
          <'\tgit clone --reference=src-3 --reference=src-4 src target-9 &&\n'> <'\tgrep /src-3/ target-9/.git/objects/info/alternates &&\n'> 
          <'\tgrep /src-4/ target-9/.git/objects/info/alternates\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone from original with relative alternate'>)} 
      {
        (SQ <'\n'> <'\tmkdir nest &&\n'> <'\tgit clone --bare src nest/src-5 &&\n'> 
          <'\techo ../../../src/.git/objects >nest/src-5/objects/info/alternates &&\n'> <'\tgit clone --bare nest/src-5 target-10 &&\n'> 
          <'\tgrep /src/\\\\.git/objects target-10/objects/info/alternates\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone checking out a tag'>)} 
      {
        (SQ <'\n'> <'\tgit clone --branch=some-tag src dst.tag &&\n'> 
          <'\tGIT_DIR=src/.git git rev-parse some-tag >expected &&\n'> <'\ttest_cmp expected dst.tag/.git/HEAD &&\n'> 
          <'\tGIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual &&\n'> <'\techo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected &&\n'> 
          <'\ttest_cmp fetch.expected fetch.actual\n'>
        )
      }
    )
    (command.FuncDef
      name: setup_ssh_wrapper
      body: 
        (command.BraceGroup
          children: [
            (C {(test_expect_success)} {(SQ <'setup ssh wrapper'>)} 
              {
                (SQ <'\n'> <'\t\tcp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \\\n'> 
                  <'\t\t\t"$TRASH_DIRECTORY/ssh-wrapper$X" &&\n'> <'\t\tGIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&\n'> <'\t\texport GIT_SSH &&\n'> 
                  <'\t\texport TRASH_DIRECTORY &&\n'> <'\t\t>"$TRASH_DIRECTORY"/ssh-output\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.FuncDef
      name: copy_ssh_wrapper_as
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (C {(cp)} 
                  {
                    (DQ ($ VSub_DollarName '$TRASH_DIRECTORY') (/ssh-wrapper) ($ VSub_DollarName '$X'))
                  } 
                  {
                    (DQ 
                      (word_part.BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VOp1_Percent
                            arg_word: {($ VSub_DollarName '$X')}
                          )
                      ) ($ VSub_DollarName '$X')
                    )
                  }
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:GIT_SSH)
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (word_part.BracedVarSub
                              token: <VSub_Number 1>
                              suffix_op: 
                                (suffix_op.StringUnary
                                  op_id: VOp1_Percent
                                  arg_word: {($ VSub_DollarName '$X')}
                                )
                            ) ($ VSub_DollarName '$X')
                          )
                        }
                    )
                  ]
                )
                (C {(export)} {(GIT_SSH)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: expect_ssh
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (C {(test_when_finished)} 
                  {
                    (SQ <'\n'> <'\t\t(cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)\n'> 
                      <'\t'>
                    )
                  }
                )
                (command.BraceGroup
                  children: [
                    (command.Case
                      to_match: {(DQ ($ VSub_Pound '$#'))}
                      arms: [
                        (case_arm pat_list:[{(1)}])
                        (case_arm
                          pat_list: [{(2)}]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ ('ssh: ') ($ VSub_Number '$1') (" git-upload-pack '") 
                                  ($ VSub_Number '$2') ("'")
                                )
                              }
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(3)}]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ ('ssh: ') ($ VSub_Number '$1') (' ') ($ VSub_Number '$2') 
                                  (" git-upload-pack '") ($ VSub_Number '$3') ("'")
                                )
                              }
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_Other '*')}]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ ('ssh: ') ($ VSub_Number '$1') (' ') ($ VSub_Number '$2') 
                                  (" git-upload-pack '") ($ VSub_Number '$3') ("' ") ($ VSub_Number '$4')
                                )
                              }
                            )
                          ]
                        )
                      ]
                    )
                  ]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_DollarName '$TRASH_DIRECTORY') (/ssh-expect))}
                    )
                  ]
                )
                (command.Subshell
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(cd)} {(DQ ($ VSub_DollarName '$TRASH_DIRECTORY'))})
                            (C {(test_cmp)} {(ssh-expect)} {(ssh-output)})
                          ]
                        )
                      ]
                    )
                )
              ]
            )
          ]
        )
    )
    (C {(setup_ssh_wrapper)})
    (C {(test_expect_success)} {(SQ <'clone myhost:src uses ssh'>)} 
      {(SQ <'\n'> <'\tgit clone myhost:src ssh-clone &&\n'> <'\texpect_ssh myhost src\n'>)}
    )
    (C {(test_expect_success)} {(KW_Bang '!') (MINGW) (Lit_Comma ',') (KW_Bang '!') (CYGWIN)} 
      {(SQ <'clone local path foo:bar'>)} 
      {
        (SQ <'\n'> <'\tcp -R src "foo:bar" &&\n'> <'\tgit clone "foo:bar" foobar &&\n'> 
          <'\texpect_ssh none\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'bracketed hostnames are still ssh'>)} 
      {
        (SQ <'\n'> <'\tgit clone "[myhost:123]:src" ssh-bracket-clone &&\n'> 
          <'\texpect_ssh "-p 123" myhost src\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'uplink is not treated as putty'>)} 
      {
        (SQ <'\n'> <'\tcopy_ssh_wrapper_as "$TRASH_DIRECTORY/uplink" &&\n'> 
          <'\tgit clone "[myhost:123]:src" ssh-bracket-clone-uplink &&\n'> <'\texpect_ssh "-p 123" myhost src\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'plink is treated specially (as putty)'>)} 
      {
        (SQ <'\n'> <'\tcopy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&\n'> 
          <'\tgit clone "[myhost:123]:src" ssh-bracket-clone-plink-0 &&\n'> <'\texpect_ssh "-P 123" myhost src\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'plink.exe is treated specially (as putty)'>)} 
      {
        (SQ <'\n'> <'\tcopy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&\n'> 
          <'\tgit clone "[myhost:123]:src" ssh-bracket-clone-plink-1 &&\n'> <'\texpect_ssh "-P 123" myhost src\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'tortoiseplink is like putty, with extra arguments'>)} 
      {
        (SQ <'\n'> <'\tcopy_ssh_wrapper_as "$TRASH_DIRECTORY/tortoiseplink" &&\n'> 
          <'\tgit clone "[myhost:123]:src" ssh-bracket-clone-plink-2 &&\n'> <'\texpect_ssh "-batch -P 123" myhost src\n'>
        )
      }
    )
    (C {(setup_ssh_wrapper)})
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:counter) op:Equal rhs:{(0)})]
    )
    (command.FuncDef
      name: test_clone_url
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:counter)
                  op: Equal
                  rhs: 
                    {
                      (word_part.ArithSubPart
                        anode: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Plus
                            left: (arith_expr.ArithWord w:{($ VSub_DollarName '$counter')})
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                    }
                )
              ]
            )
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (C {(test_might_fail)} {(git)} {(clone)} {(DQ ($ VSub_Number '$1'))} 
                  {(tmp) ($ VSub_DollarName '$counter')}
                )
                (C {(shift)})
                (C {(expect_ssh)} {(DQ ($ VSub_At '$@'))})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(KW_Bang '!') (MINGW)} {(SQ <'clone c:temp is ssl'>)} 
      {(SQ <'\n'> <'\ttest_clone_url c:temp c temp\n'>)}
    )
    (C {(test_expect_success)} {(MINGW)} {(SQ <'clone c:temp is dos drive'>)} 
      {(SQ <'\n'> <'\ttest_clone_url c:temp none\n'>)}
    )
    (command.ForEach
      iter_name: repo
      iter_words: [{(rep)} {(rep/home/project)} {(123)}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('clone host:') ($ VSub_DollarName '$repo'))} 
              {(SQ <'\n'> <'\t\ttest_clone_url host:$repo host $repo\n'> <'\t'>)}
            )
          ]
        )
    )
    (command.ForEach
      iter_name: repo
      iter_words: [{(rep)} {(rep/home/project)} {(123)}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('clone [::1]:') ($ VSub_DollarName '$repo'))} 
              {(SQ <'\n'> <'\t\ttest_clone_url [::1]:$repo ::1 "$repo"\n'> <'\t'>)}
            )
          ]
        )
    )
    (C {(test_expect_success)} {(DQ ('clone host:/~repo'))} 
      {(SQ <'\n'> <'\ttest_clone_url host:/~repo host "~repo"\n'>)}
    )
    (C {(test_expect_success)} {(DQ ('clone [::1]:/~repo'))} 
      {(SQ <'\n'> <'\ttest_clone_url [::1]:/~repo ::1 "~repo"\n'>)}
    )
    (command.ForEach
      iter_name: url
      iter_words: [
        {(foo/bar) (Lit_Other ':') (baz)}
        {(Lit_Other '[') (foo) (Lit_Other ']') (bar/baz) (Lit_Other ':') (qux)}
        {(Lit_Other '[') (foo/bar) (Lit_Other ']') (Lit_Other ':') (baz)}
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('clone ') ($ VSub_DollarName '$url') (' is not ssh'))} 
              {(SQ <'\n'> <'\t\ttest_clone_url $url none\n'> <'\t'>)}
            )
          ]
        )
    )
    (command.ForEach
      iter_name: tcol
      iter_words: [{(DQ )} {(Lit_Other ':')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} 
              {(DQ ('clone ssh://host.xz') ($ VSub_DollarName '$tcol') (/home/user/repo))} 
              {
                (SQ <'\n'> 
                  <
'\t\ttest_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo\n'
                  > <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('clone ssh://host.xz') ($ VSub_DollarName '$tcol') ('/~repo'))} {(SQ <'\n'> <'\ttest_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"\n'>)}
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ <'clone ssh://host.xz:22/home/user/repo'>)} 
      {
        (SQ <'\n'> 
          <'\ttest_clone_url "ssh://host.xz:22/home/user/repo" "-p 22 host.xz" "/home/user/repo"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'clone ssh://host.xz:22/~repo'>)} 
      {(SQ <'\n'> <'\ttest_clone_url "ssh://host.xz:22/~repo" "-p 22 host.xz" "~repo"\n'>)}
    )
    (command.ForEach
      iter_name: tuah
      iter_words: [
        {(Lit_Other ':') (Lit_Other ':') (1)}
        {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') (Lit_Other ':')}
        {(user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1)}
        {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') 
          (Lit_Other ':')
        }
        {(Lit_Other '[') (user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(Lit_Other '[') (user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') 
          (Lit_Other ':')
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:ehost)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_DollarName '$tuah')})
                                  (C {(sed)} {(-e)} {(DQ ('s/1]:/1]/'))})
                                  (C {(tr)} {(-d)} {(DQ ('[]'))})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(test_expect_success)} 
              {(DQ ('clone ssh://') ($ VSub_DollarName '$tuah') (/home/user/repo))} 
              {
                (DQ ('\n') ('\t  test_clone_url ssh://') ($ VSub_DollarName '$tuah') 
                  ('/home/user/repo ') ($ VSub_DollarName '$ehost') (' /home/user/repo\n') ('\t')
                )
              }
            )
          ]
        )
    )
    (command.ForEach
      iter_name: tuah
      iter_words: [
        {(Lit_Other ':') (Lit_Other ':') (1)}
        {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1)}
        {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(Lit_Other '[') (user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:euah)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_DollarName '$tuah')})
                                  (C {(tr)} {(-d)} {(DQ ('[]'))})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(test_expect_success)} {(DQ ('clone ssh://') ($ VSub_DollarName '$tuah') ('/~repo'))} 
              {
                (DQ ('\n') ('\t  test_clone_url ssh://') ($ VSub_DollarName '$tuah') ('/~repo ') 
                  ($ VSub_DollarName '$euah') (" '~repo'\n") ('\t')
                )
              }
            )
          ]
        )
    )
    (command.ForEach
      iter_name: tuah
      iter_words: [
        {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(Lit_Other '[') (user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:euah)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_DollarName '$tuah')})
                                  (C {(tr)} {(-d)} {(DQ ('[]'))})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(test_expect_success)} 
              {(DQ ('clone ssh://') ($ VSub_DollarName '$tuah') (':22/home/user/repo'))} 
              {
                (DQ ('\n') ('\t  test_clone_url ssh://') ($ VSub_DollarName '$tuah') 
                  (":22/home/user/repo '-p 22' ") ($ VSub_DollarName '$euah') (' /home/user/repo\n') ('\t')
                )
              }
            )
          ]
        )
    )
    (command.ForEach
      iter_name: tuah
      iter_words: [
        {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
        {(Lit_Other '[') (user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')}
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:euah)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_DollarName '$tuah')})
                                  (C {(tr)} {(-d)} {(DQ ('[]'))})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(test_expect_success)} {(DQ ('clone ssh://') ($ VSub_DollarName '$tuah') (':22/~repo'))} 
              {
                (DQ ('\n') ('\t  test_clone_url ssh://') ($ VSub_DollarName '$tuah') 
                  (":22/~repo '-p 22' ") ($ VSub_DollarName '$euah') (" '~repo'\n") ('\t')
                )
              }
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ <'clone from a repository with two identical branches'>)} 
      {
        (SQ <'\n'> <'\n'> <'\t(\n'> <'\t\tcd src &&\n'> <'\t\tgit checkout -b another master\n'> 
          <'\t) &&\n'> <'\tgit clone src target-11 &&\n'> 
          <'\ttest "z$( cd target-11 && git symbolic-ref HEAD )" = zrefs/heads/another\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'shallow clone locally'>)} 
      {
        (SQ <'\n'> <'\tgit clone --depth=1 --no-local src ssrrcc &&\n'> 
          <'\tgit clone ssrrcc ddsstt &&\n'> <'\ttest_cmp ssrrcc/.git/shallow ddsstt/.git/shallow &&\n'> <'\t( cd ddsstt && git fsck )\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'GIT_TRACE_PACKFILE produces a usable pack'>)} 
      {
        (SQ <'\n'> <'\trm -rf dst.git &&\n'> 
          <'\tGIT_TRACE_PACKFILE=$PWD/tmp.pack git clone --no-local --bare src dst.git &&\n'> <'\tgit init --bare replay.git &&\n'> <'\tgit -C replay.git index-pack -v --stdin <tmp.pack\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)