(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[12])
          op: Equal
          rhs: {(SQ <'selecting remote repo in ambiguous cases'>)}
          spids: [12]
        )
      ]
      spids: [12]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.FuncDef
      name: reset
      body: 
        (command.BraceGroup
          children: [(C {(rm)} {(-rf)} {(foo)} {(foo.git)} {(fetch)} {(clone)})]
          spids: [26]
        )
      spids: [22 25]
    )
    (command.FuncDef
      name: make_tree
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(git)} {(init)} {(DQ ($ VSub_Number '$1'))})
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(cd)} {(DQ ($ VSub_Number '$1'))})
                        (C {(test_commit)} {(DQ ($ VSub_Number '$1'))})
                      ]
                    )
                  spids: [62 76]
                )
              ]
            )
          ]
          spids: [48]
        )
      spids: [44 47]
    )
    (command.FuncDef
      name: make_bare
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(git)} {(init)} {(--bare)} {(DQ ($ VSub_Number '$1'))})
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp Op_DAmp]
                      children: [
                        (C {(cd)} {(DQ ($ VSub_Number '$1'))})
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:tree spids:[111])
                              op: Equal
                              rhs: 
                                {
                                  (word_part.CommandSubPart
                                    command_list: 
                                      (command.CommandList
                                        children: [
                                          (C {(git)} {(hash-object)} {(-w)} {(-t)} {(tree)} {(/dev/null)})
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [112 124]
                                  )
                                }
                              spids: [111]
                            )
                          ]
                          spids: [111]
                        )
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:commit spids:[129])
                              op: Equal
                              rhs: 
                                {
                                  (word_part.CommandSubPart
                                    command_list: 
                                      (command.CommandList
                                        children: [
                                          (command.Pipeline
                                            children: [
                                              (C {(echo)} {(DQ ($ VSub_Number '$1'))})
                                              (C {(git)} {(commit-tree)} {($ VSub_Name '$tree')})
                                            ]
                                            negated: F
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [130 144]
                                  )
                                }
                              spids: [129]
                            )
                          ]
                          spids: [129]
                        )
                        (C {(git)} {(update-ref)} {(HEAD)} {($ VSub_Name '$commit')})
                      ]
                    )
                  spids: [101 158]
                )
              ]
            )
          ]
          spids: [85]
        )
      spids: [81 84]
    )
    (command.FuncDef
      name: get
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (C {(git)} {(init)} {(--bare)} {(fetch)})
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(cd)} {(fetch)})
                        (C {(git)} {(fetch)} {(DQ (../) ($ VSub_Number '$1'))})
                      ]
                    )
                  spids: [181 196]
                )
                (C {(git)} {(clone)} {(DQ ($ VSub_Number '$1'))} {(clone)})
              ]
            )
          ]
          spids: [167]
        )
      spids: [163 166]
    )
    (command.FuncDef
      name: check
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ($ VSub_Number '$1'))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})]
                )
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(cd)} {(fetch)})
                        (C {(git)} {(log)} {(-1)} {(--format) (Lit_Other '=') (Lit_Other '%') (s)} 
                          {(FETCH_HEAD)}
                        )
                      ]
                    )
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual.fetch)})]
                  spids: [233 252]
                )
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(cd)} {(clone)})
                        (C {(git)} {(log)} {(-1)} {(--format) (Lit_Other '=') (Lit_Other '%') (s)} 
                          {(HEAD)}
                        )
                      ]
                    )
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual.clone)})]
                  spids: [260 279]
                )
                (C {(test_cmp)} {(expect)} {(actual.fetch)})
                (C {(test_cmp)} {(expect)} {(actual.clone)})
              ]
            )
          ]
          spids: [218]
        )
      spids: [214 217]
    )
    (C {(test_expect_success)} {(SQ <'find .git dir in worktree'>)} 
      {(SQ <'\n'> <'\treset &&\n'> <'\tmake_tree foo &&\n'> <'\tget foo &&\n'> <'\tcheck foo\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'automagically add .git suffix'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_bare foo.git &&\n'> <'\tget foo &&\n'> <'\tcheck foo.git\n'>)
      }
    )
    (C {(test_expect_success)} {(SQ <'automagically add .git suffix to worktree'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_tree foo.git &&\n'> <'\tget foo &&\n'> <'\tcheck foo.git\n'>)
      }
    )
    (C {(test_expect_success)} {(SQ <'prefer worktree foo over bare foo.git'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_tree foo &&\n'> <'\tmake_bare foo.git &&\n'> 
          <'\tget foo &&\n'> <'\tcheck foo\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'prefer bare foo over bare foo.git'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_bare foo &&\n'> <'\tmake_bare foo.git &&\n'> 
          <'\tget foo &&\n'> <'\tcheck foo\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'disambiguate with full foo.git'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_bare foo &&\n'> <'\tmake_bare foo.git &&\n'> 
          <'\tget foo.git &&\n'> <'\tcheck foo.git\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'we are not fooled by non-git foo directory'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_bare foo.git &&\n'> <'\tmkdir foo &&\n'> <'\tget foo &&\n'> 
          <'\tcheck foo.git\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'prefer inner .git over outer bare'>)} 
      {
        (SQ <'\n'> <'\treset &&\n'> <'\tmake_tree foo &&\n'> <'\tmake_bare foo.git &&\n'> 
          <'\tmv foo/.git foo.git &&\n'> <'\tget foo.git &&\n'> <'\tcheck foo\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)