(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ (Token id:Id.Lit_Chars val:'test git clone to cleanup after failure\n' span_id:15) 
                (Token id:Id.Lit_Chars val:'\n' span_id:16) 
                (Token
                  id: Id.Lit_Chars
                  val: 'This test covers the fact that if git clone fails, it should remove\n'
                  span_id: 17
                ) 
                (Token
                  id: Id.Lit_Chars
                  val: 'the directory it created, to avoid the user having to manually\n'
                  span_id: 18
                ) (Token id:Id.Lit_Chars val:'remove the directory before attempting a clone again.' span_id:19)
              )
            }
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'clone of non-existent source should fail' span_id:33))} {(SQ (Token id:Id.Lit_Chars val:'test_must_fail git clone foo bar' span_id:39))}
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'failed clone should not leave a directory' span_id:48))} {(SQ (Token id:Id.Lit_Chars val:'! test -d bar' span_id:54))}
    )
    (C {(test_create_repo)} {(foo)})
    (command.Subshell
      command_list: 
        (command.CommandList
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(cd)} {(foo)})
                (C {(touch)} {(file)})
                (C {(git)} {(add)} {(file)})
                (command.Simple
                  words: [
                    {(git)}
                    {(commit)}
                    {(-m)}
                    {(SQ (Token id:Id.Lit_Chars val:'add file' span_id:97))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:100)
                      fd: -1
                      arg_word: {(/dev/null)}
                    )
                    (redir.Redir
                      op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:103)
                      fd: 2
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'clone of non-existent (relative to $PWD) source should fail'
            span_id: 119
          )
        )
      } {(SQ (Token id:Id.Lit_Chars val:'test_must_fail git clone ../foo baz' span_id:125))}
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'clone should work now that source exists' span_id:134))} {(SQ (Token id:Id.Lit_Chars val:'git clone foo bar' span_id:140))}
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'successful clone must leave the directory' span_id:149))} {(SQ (Token id:Id.Lit_Chars val:'test -d bar' span_id:155))}
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'failed clone --separate-git-dir should not leave any directories'
            span_id: 162
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:166) 
          (Token id:Id.Lit_Chars val:'\tmkdir foo/.git/objects.bak/ &&\n' span_id:167) (Token id:Id.Lit_Chars val:'\tmv foo/.git/objects/* foo/.git/objects.bak/ &&\n' span_id:168) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git clone --separate-git-dir gitdir foo worktree &&\n'
            span_id: 169
          ) (Token id:Id.Lit_Chars val:'\ttest_must_fail test -e gitdir &&\n' span_id:170) 
          (Token id:Id.Lit_Chars val:'\ttest_must_fail test -e worktree &&\n' span_id:171) (Token id:Id.Lit_Chars val:'\tmv foo/.git/objects.bak/* foo/.git/objects/ &&\n' span_id:172) 
          (Token id:Id.Lit_Chars val:'\trmdir foo/.git/objects.bak\n' span_id:173)
        )
      }
    )
    (C {(test_done)})
  ]
)