(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"Test git update-ref error handling">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: test_update_rejected
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:before)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number "$1"))}
                      spids: [52]
                    )
                  ]
                  spids: [52]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:pack)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number "$2"))}
                          spids: [60]
                        )
                      ]
                      spids: [60]
                    )
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:create)
                              op: Equal
                              rhs: {(DQ ($ VSub_Number "$3"))}
                              spids: [68]
                            )
                          ]
                          spids: [68]
                        )
                        (AndOr
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:error)
                                  op: Equal
                                  rhs: {(DQ ($ VSub_Number "$4"))}
                                  spids: [76]
                                )
                              ]
                              spids: [76]
                            )
                            (AndOr
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(printf)} 
                                      {
                                        (DQ ("create ") ($ VSub_Name "$prefix") ("/%s ") 
                                          ($ VSub_Name "$C") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">)
                                        )
                                      } {($ VSub_Name "$before")}
                                    )
                                    (C {(git)} {(update-ref)} {(--stdin)})
                                  ]
                                  negated: False
                                )
                                (AndOr
                                  children: [
                                    (SimpleCommand
                                      words: [{(git)} {(for-each-ref)} {($ VSub_Name "$prefix")}]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_Great
                                          fd: -1
                                          arg_word: {(unchanged)}
                                          spids: [114]
                                        )
                                      ]
                                    )
                                    (AndOr
                                      children: [
                                        (If
                                          arms: [
                                            (if_arm
                                              cond: [(C {($ VSub_Name "$pack")})]
                                              action: [(C {(git)} {(pack-refs)} {(--all)})]
                                              spids: [-1 125]
                                            )
                                          ]
                                          spids: [-1 135]
                                        )
                                        (AndOr
                                          children: [
                                            (SimpleCommand
                                              words: [
                                                {(printf)}
                                                {
                                                  (DQ ("create ") ($ VSub_Name "$prefix") ("/%s ") 
                                                    ($ VSub_Name "$C") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">)
                                                  )
                                                }
                                                {($ VSub_Name "$create")}
                                              ]
                                              redirects: [
                                                (Redir
                                                  op_id: Redir_Great
                                                  fd: -1
                                                  arg_word: {(input)}
                                                  spids: [152]
                                                )
                                              ]
                                            )
                                            (AndOr
                                              children: [
                                                (SimpleCommand
                                                  words: [
                                                    {(test_must_fail)}
                                                    {(git)}
                                                    {(update-ref)}
                                                    {(--stdin)}
                                                  ]
                                                  redirects: [
                                                    (Redir
                                                      op_id: Redir_Less
                                                      fd: -1
                                                      arg_word: {(input)}
                                                      spids: [166]
                                                    )
                                                    (Redir
                                                      op_id: Redir_Great
                                                      fd: 2
                                                      arg_word: {(output.err)}
                                                      spids: [169]
                                                    )
                                                  ]
                                                )
                                                (AndOr
                                                  children: [
                                                    (C {(grep)} {(-F)} {(DQ ($ VSub_Name "$error"))} 
                                                      {(output.err)}
                                                    )
                                                    (AndOr
                                                      children: [
                                                        (SimpleCommand
                                                          words: [
                                                            {(git)}
                                                            {(for-each-ref)}
                                                            {($ VSub_Name "$prefix")}
                                                          ]
                                                          redirects: [
                                                            (Redir
                                                              op_id: Redir_Great
                                                              fd: -1
                                                              arg_word: {(actual)}
                                                              spids: [194]
                                                            )
                                                          ]
                                                        )
                                                        (C {(test_cmp)} {(unchanged)} {(actual)})
                                                      ]
                                                      op_id: Op_DAmp
                                                    )
                                                  ]
                                                  op_id: Op_DAmp
                                                )
                                              ]
                                              op_id: Op_DAmp
                                            )
                                          ]
                                          op_id: Op_DAmp
                                        )
                                      ]
                                      op_id: Op_DAmp
                                    )
                                  ]
                                  op_id: Op_DAmp
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [49]
        )
      spids: [44 48]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:Q) op:Equal rhs:{(DQ ("'"))} spids:[209])]
      spids: [209]
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <"\n"> <"\n"> <"\tgit commit --allow-empty -m Initial &&\n"> 
          <"\tC=$(git rev-parse HEAD) &&\n"> <"\tgit commit --allow-empty -m Second &&\n"> <"\tD=$(git rev-parse HEAD) &&\n"> 
          <"\tgit commit --allow-empty -m Third &&\n"> <"\tE=$(git rev-parse HEAD)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing loose ref is a simple prefix of new">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/1l &&\n"> 
          <"\ttest_update_rejected \"a c e\" false \"b c/x d\" \\\n"> <"\t\t\"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing packed ref is a simple prefix of new">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/1p &&\n"> 
          <"\ttest_update_rejected \"a c e\" true \"b c/x d\" \\\n"> <"\t\t\"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing loose ref is a deeper prefix of new">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/2l &&\n"> 
          <"\ttest_update_rejected \"a c e\" false \"b c/x/y d\" \\\n"> <"\t\t\"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing packed ref is a deeper prefix of new">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/2p &&\n"> 
          <"\ttest_update_rejected \"a c e\" true \"b c/x/y d\" \\\n"> <"\t\t\"$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"new ref is a simple prefix of existing loose">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/3l &&\n"> 
          <"\ttest_update_rejected \"a c/x e\" false \"b c d\" \\\n"> <"\t\t\"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"new ref is a simple prefix of existing packed">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/3p &&\n"> 
          <"\ttest_update_rejected \"a c/x e\" true \"b c d\" \\\n"> <"\t\t\"$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"new ref is a deeper prefix of existing loose">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/4l &&\n"> 
          <"\ttest_update_rejected \"a c/x/y e\" false \"b c d\" \\\n"> <"\t\t\"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"new ref is a deeper prefix of existing packed">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/4p &&\n"> 
          <"\ttest_update_rejected \"a c/x/y e\" true \"b c d\" \\\n"> <"\t\t\"$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"one new ref is a simple prefix of another">)} 
      {
        (SQ <"\n"> <"\n"> <"\tprefix=refs/5 &&\n"> 
          <"\ttest_update_rejected \"a e\" false \"b c c/x d\" \\\n"> <"\t\t\"cannot process $Q$prefix/c$Q and $Q$prefix/c/x$Q at the same time\"\n"> <"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool rev-parse">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-rev-parse &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\techo \"$C\" >expected &&\n"> 
          <"\tgit rev-parse $prefix/foo >actual &&\n"> <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool for-each-ref">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-for-each-ref &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit for-each-ref $prefix >expected &&\n"> <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> 
          <"\tgit for-each-ref $prefix >actual &&\n"> <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-create &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> 
          <"\tprintf \"create %s $C\\n\" $prefix/foo |\n"> <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool verify">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-verify &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\tprintf \"verify %s $C\\n\" $prefix/foo |\n"> 
          <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool 1-arg update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-update-1 &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\tprintf \"update %s $D\\n\" $prefix/foo |\n"> 
          <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool 2-arg update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-update-2 &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\tprintf \"update %s $D $C\\n\" $prefix/foo |\n"> 
          <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool 0-arg delete">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-delete-0 &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\tprintf \"delete %s\\n\" $prefix/foo |\n"> 
          <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"empty directory should not fool 1-arg delete">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/e-delete-1 &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tmkdir -p .git/$prefix/foo/bar/baz &&\n"> <"\tprintf \"delete %s $C\\n\" $prefix/foo |\n"> 
          <"\tgit update-ref --stdin\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"missing old value blocks update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/missing-update &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/foo $E $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-update &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tcat >expected <<-EOF &&\n"> <"\tfatal: cannot lock ref $Q$prefix/foo$Q: is at $C but expected $D\n"> <"\tEOF\n"> 
          <"\tprintf \"%s\\n\" \"update $prefix/foo $E $D\" |\n"> <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing old value blocks create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/existing-create &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tcat >expected <<-EOF &&\n"> <"\tfatal: cannot lock ref $Q$prefix/foo$Q: reference already exists\n"> <"\tEOF\n"> 
          <"\tprintf \"%s\\n\" \"create $prefix/foo $E\" |\n"> <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks delete">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-delete &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> 
          <"\tcat >expected <<-EOF &&\n"> <"\tfatal: cannot lock ref $Q$prefix/foo$Q: is at $C but expected $D\n"> <"\tEOF\n"> 
          <"\tprintf \"%s\\n\" \"delete $prefix/foo $D\" |\n"> <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"missing old value blocks indirect update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/missing-indirect-update &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $E $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks indirect update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-indirect-update &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $E $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing old value blocks indirect create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/existing-indirect-create &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: reference already exists\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"create $prefix/symref $E\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks indirect delete">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-indirect-delete &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"delete $prefix/symref $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"missing old value blocks indirect no-deref update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/missing-noderef-update &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: reference is missing but expected $D\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"option no-deref\" \"update $prefix/symref $E $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks indirect no-deref update">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-noderef-update &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"option no-deref\" \"update $prefix/symref $E $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"existing old value blocks indirect no-deref create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/existing-noderef-create &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: reference already exists\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"option no-deref\" \"create $prefix/symref $E\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"incorrect old value blocks indirect no-deref delete">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/incorrect-noderef-delete &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tgit update-ref $prefix/foo $C &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <"\tfatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D\n"> <"\tEOF\n"> <"\tprintf \"%s\\n\" \"option no-deref\" \"delete $prefix/symref $D\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"non-empty directory blocks create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/ne-create &&\n"> <"\tmkdir -p .git/$prefix/foo/bar &&\n"> 
          <"\t: >.git/$prefix/foo/bar/baz.lock &&\n"> <"\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/foo$Q: there is a non-empty directory $Q.git/$prefix/foo$Q blocking reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"broken reference blocks create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/broken-create &&\n"> <"\tmkdir -p .git/$prefix &&\n"> 
          <"\techo \"gobbledigook\" >.git/$prefix/foo &&\n"> <"\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/foo $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/foo $D $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"non-empty directory blocks indirect create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/ne-indirect-create &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\tmkdir -p .git/$prefix/foo/bar &&\n"> <"\t: >.git/$prefix/foo/bar/baz.lock &&\n"> 
          <"\ttest_when_finished \"rm -f .git/$prefix/foo/bar/baz.lock\" &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/symref$Q: there is a non-empty directory $Q.git/$prefix/foo$Q blocking reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"broken reference blocks indirect create">)} 
      {
        (SQ <"\n"> <"\tprefix=refs/broken-indirect-create &&\n"> 
          <"\tgit symbolic-ref $prefix/symref $prefix/foo &&\n"> <"\techo \"gobbledigook\" >.git/$prefix/foo &&\n"> 
          <"\ttest_when_finished \"rm -f .git/$prefix/foo\" &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err &&\n"> <"\tcat >expected <<-EOF &&\n"> 
          <
"\tfatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken\n"
          > <"\tEOF\n"> <"\tprintf \"%s\\n\" \"update $prefix/symref $D $C\" |\n"> 
          <"\ttest_must_fail git update-ref --stdin 2>output.err &&\n"> <"\ttest_cmp expected output.err\n">
        )
      }
    )
    (C {(test_done)})
  ]
)