(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <'.git file\n'> <'\n'> <'Verify that plumbing commands work when .git is a file\n'>)
            }
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: objpath
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(echo)} {(DQ ($ VSub_Number '$1'))})
                (C {(sed)} {(-e)} {(SQ <'s|\\(..\\)|\\1/|'>)})
              ]
              negated: False
            )
          ]
          spids: [20]
        )
      spids: [16 19]
    )
    (FuncDef
      name: objck
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:p)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(objpath)} {(DQ ($ VSub_Number '$1'))})]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [50 56]
                      )
                    }
                  spids: [49]
                )
              ]
              spids: [49]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (C {(test)} {(KW_Bang '!')} {(-f)} 
                      {(DQ ($ VSub_Name '$REAL') (/objects/) ($ VSub_Name '$p'))}
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Object not found: ') ($ VSub_Name '$REAL') (/objects/) ($ VSub_Name '$p'))
                      }
                    )
                    (C {(false)})
                  ]
                  spids: [16777215 74]
                )
              ]
              spids: [16777215 90]
            )
          ]
          spids: [46]
        )
      spids: [42 45]
    )
    (C {(test_expect_success)} {(SQ <'initial setup'>)} 
      {(SQ <'\n'> <'\tREAL="$(pwd)/.real" &&\n'> <'\tmv .git "$REAL"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'bad setup: invalid .git file format'>)} 
      {
        (SQ <'\n'> <'\techo "gitdir $REAL" >.git &&\n'> <'\tif git rev-parse 2>.err\n'> <'\tthen\n'> 
          <'\t\techo "git rev-parse accepted an invalid .git file"\n'> <'\t\tfalse\n'> <'\tfi &&\n'> <'\tif ! grep "Invalid gitfile format" .err\n'> <'\tthen\n'> 
          <'\t\techo "git rev-parse returned wrong error"\n'> <'\t\tfalse\n'> <'\tfi\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'bad setup: invalid .git file path'>)} 
      {
        (SQ <'\n'> <'\techo "gitdir: $REAL.not" >.git &&\n'> <'\tif git rev-parse 2>.err\n'> 
          <'\tthen\n'> <'\t\techo "git rev-parse accepted an invalid .git file path"\n'> <'\t\tfalse\n'> <'\tfi &&\n'> 
          <'\tif ! grep "Not a git repository" .err\n'> <'\tthen\n'> <'\t\techo "git rev-parse returned wrong error"\n'> <'\t\tfalse\n'> <'\tfi\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'final setup + check rev-parse --git-dir'>)} 
      {
        (SQ <'\n'> <'\techo "gitdir: $REAL" >.git &&\n'> 
          <'\ttest "$REAL" = "$(git rev-parse --git-dir)"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'check hash-object'>)} 
      {
        (SQ <'\n'> <'\techo "foo" >bar &&\n'> <'\tSHA=$(cat bar | git hash-object -w --stdin) &&\n'> 
          <'\tobjck $SHA\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'check cat-file'>)} 
      {(SQ <'\n'> <'\tgit cat-file blob $SHA >actual &&\n'> <'\ttest_cmp bar actual\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'check update-index'>)} 
      {
        (SQ <'\n'> <'\tif test -f "$REAL/index"\n'> <'\tthen\n'> 
          <'\t\techo "Hmm, $REAL/index exists?"\n'> <'\t\tfalse\n'> <'\tfi &&\n'> <'\trm -f "$REAL/objects/$(objpath $SHA)" &&\n'> 
          <'\tgit update-index --add bar &&\n'> <'\tif ! test -f "$REAL/index"\n'> <'\tthen\n'> <'\t\techo "$REAL/index not found"\n'> <'\t\tfalse\n'> 
          <'\tfi &&\n'> <'\tobjck $SHA\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'check write-tree'>)} 
      {(SQ <'\n'> <'\tSHA=$(git write-tree) &&\n'> <'\tobjck $SHA\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'check commit-tree'>)} 
      {(SQ <'\n'> <'\tSHA=$(echo "commit bar" | git commit-tree $SHA) &&\n'> <'\tobjck $SHA\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'check rev-list'>)} 
      {(SQ <'\n'> <'\techo $SHA >"$REAL/HEAD" &&\n'> <'\ttest "$SHA" = "$(git rev-list HEAD)"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'setup_git_dir twice in subdir'>)} 
      {
        (SQ <'\n'> <'\tgit init sgd &&\n'> <'\t(\n'> <'\t\tcd sgd &&\n'> 
          <'\t\tgit config alias.lsfi ls-files &&\n'> <'\t\tmv .git .realgit &&\n'> <'\t\techo "gitdir: .realgit" >.git &&\n'> <'\t\tmkdir subdir &&\n'> 
          <'\t\tcd subdir &&\n'> <'\t\t>foo &&\n'> <'\t\tgit add foo &&\n'> <'\t\tgit lsfi >actual &&\n'> <'\t\techo foo >expected &&\n'> 
          <'\t\ttest_cmp expected actual\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'enter_repo non-strict mode'>)} 
      {
        (SQ <'\n'> <'\ttest_create_repo enter_repo &&\n'> <'\t(\n'> <'\t\tcd enter_repo &&\n'> 
          <'\t\ttest_tick &&\n'> <'\t\ttest_commit foo &&\n'> <'\t\tmv .git .realgit &&\n'> <'\t\techo "gitdir: .realgit" >.git\n'> 
          <'\t) &&\n'> <'\tgit ls-remote enter_repo >actual &&\n'> <'\tcat >expected <<-\\EOF &&\n'> 
          <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n'> <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n'> 
          <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'enter_repo linked checkout'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd enter_repo &&\n'> <'\t\tgit worktree add  ../foo refs/tags/foo\n'> 
          <'\t) &&\n'> <'\tgit ls-remote foo >actual &&\n'> <'\tcat >expected <<-\\EOF &&\n'> 
          <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n'> <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n'> 
          <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'enter_repo strict mode'>)} 
      {
        (SQ <'\n'> <'\tgit ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&\n'> 
          <'\tcat >expected <<-\\EOF &&\n'> <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n'> 
          <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n'> <'\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n'> <'\tEOF\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)