(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"Test git update-ref and basic ref logging">)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:Z) op:Equal rhs:{($ VSub_Name "$_z40")} spids:[23])]
      spids: [23]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <"\n"> <"\n"> <"\tfor name in A B C D E F\n"> <"\tdo\n"> <"\t\ttest_tick &&\n"> 
          <"\t\tT=$(git write-tree) &&\n"> <"\t\tsha1=$(echo $name | git commit-tree $T) &&\n"> <"\t\teval $name=$sha1\n"> <"\tdone\n"> <"\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:m) op:Equal rhs:{(refs/heads/master)} spids:[45])]
      spids: [45]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:n_dir) op:Equal rhs:{(refs/heads/gu)} spids:[48])]
      spids: [48]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:n)
          op: Equal
          rhs: {($ VSub_Name "$n_dir") (/fixes)}
          spids: [51]
        )
      ]
      spids: [51]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:outside) op:Equal rhs:{(refs/foo)} spids:[55])]
      spids: [55]
    )
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m"))} 
      {
        (DQ ("git update-ref ") ($ VSub_Name "$m") (" ") ($ VSub_Name "$A") (" &&\n") ("\t test ") 
          ($ VSub_Name "$A")
        ) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m"))} 
      {
        (DQ ("git update-ref ") ($ VSub_Name "$m") (" ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") 
          (" &&\n") ("\t test ") ($ VSub_Name "$B")
        ) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("fail to delete ") ($ VSub_Name "$m") (" with stale ref"))} 
      {
        (SQ <"\n"> <"\ttest_must_fail git update-ref -d $m $A &&\n"> 
          <"\ttest $B = \"$(cat .git/$m)\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(DQ ("delete ") ($ VSub_Name "$m"))} 
      {(SQ <"\n"> <"\tgit update-ref -d $m $B &&\n"> <"\t! test -f .git/$m\n">)}
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(test_expect_success)} {(DQ ("delete ") ($ VSub_Name "$m") (" without oldvalue verification"))} 
      {
        (DQ ("\n") ("\tgit update-ref ") ($ VSub_Name "$m") (" ") ($ VSub_Name "$A") (" &&\n") ("\ttest ") 
          ($ VSub_Name "$A") (" = ") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) ("(cat .git/") ($ VSub_Name "$m") (") &&\n") 
          ("\tgit update-ref -d ") ($ VSub_Name "$m") (" &&\n") ("\t! test -f .git/") ($ VSub_Name "$m") ("\n")
        )
      }
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(test_expect_success)} {(DQ ("fail to create ") ($ VSub_Name "$n"))} 
      {
        (DQ ("touch .git/") ($ VSub_Name "$n_dir") (" &&\n") ("\t test_must_fail git update-ref ") 
          ($ VSub_Name "$n") (" ") ($ VSub_Name "$A") (" >out 2>err")
        )
      }
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$n_dir")} {(out)} {(err)})
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m") (" (by HEAD)"))} 
      {(DQ ("git update-ref HEAD ") ($ VSub_Name "$A") (" &&\n") ("\t test ") ($ VSub_Name "$A")) 
        (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m") (" (by HEAD)"))} 
      {
        (DQ ("git update-ref HEAD ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" &&\n") ("\t test ") 
          ($ VSub_Name "$B")
        ) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} 
      {(DQ ("fail to delete ") ($ VSub_Name "$m") (" (by HEAD) with stale ref"))} {(SQ <"\n"> <"\ttest_must_fail git update-ref -d HEAD $A &&\n"> <"\ttest $B = $(cat .git/$m)\n">)}
    )
    (C {(test_expect_success)} {(DQ ("delete ") ($ VSub_Name "$m") (" (by HEAD)"))} 
      {(SQ <"\n"> <"\tgit update-ref -d HEAD $B &&\n"> <"\t! test -f .git/$m\n">)}
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(test_expect_success)} {(SQ <"update-ref does not create reflogs by default">)} 
      {
        (SQ <"\n"> <"\ttest_when_finished \"git update-ref -d $outside\" &&\n"> 
          <"\tgit update-ref $outside $A &&\n"> <"\tgit rev-parse $A >expect &&\n"> <"\tgit rev-parse $outside >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\ttest_must_fail git reflog exists $outside\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"update-ref creates reflogs with --create-reflog">)} 
      {
        (SQ <"\n"> <"\ttest_when_finished \"git update-ref -d $outside\" &&\n"> 
          <"\tgit update-ref --create-reflog $outside $A &&\n"> <"\tgit rev-parse $A >expect &&\n"> <"\tgit rev-parse $outside >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit reflog exists $outside\n">
        )
      }
    )
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m") (" (by HEAD)"))} 
      {(DQ ("git update-ref HEAD ") ($ VSub_Name "$A") (" &&\n") ("\t test ") ($ VSub_Name "$A")) 
        (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("pack refs"))} {(DQ ("git pack-refs --all"))})
    (C {(test_expect_success)} {(DQ ("move ") ($ VSub_Name "$m") (" (by HEAD)"))} 
      {
        (DQ ("git update-ref HEAD ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" &&\n") ("\t test ") 
          ($ VSub_Name "$B")
        ) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} 
      {
        (DQ ("delete ") ($ VSub_Name "$m") (" (by HEAD) should remove both packed and loose ") 
          ($ VSub_Name "$m")
        )
      } 
      {
        (SQ <"\n"> <"\tgit update-ref -d HEAD $B &&\n"> <"\t! grep \"$m\" .git/packed-refs &&\n"> 
          <"\t! test -f .git/$m\n">
        )
      }
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(cp)} {(-f)} {(.git/HEAD)} {(.git/HEAD.orig)})
    (C {(test_expect_success)} {(DQ ("delete symref without dereference"))} 
      {(SQ <"\n"> <"\tgit update-ref --no-deref -d HEAD &&\n"> <"\t! test -f .git/HEAD\n">)}
    )
    (C {(cp)} {(-f)} {(.git/HEAD.orig)} {(.git/HEAD)})
    (C {(test_expect_success)} 
      {(DQ ("delete symref without dereference when the referred ref is packed"))} 
      {
        (SQ <"\n"> <"\techo foo >foo.c &&\n"> <"\tgit add foo.c &&\n"> <"\tgit commit -m foo &&\n"> 
          <"\tgit pack-refs --all &&\n"> <"\tgit update-ref --no-deref -d HEAD &&\n"> <"\t! test -f .git/HEAD\n">
        )
      }
    )
    (C {(cp)} {(-f)} {(.git/HEAD.orig)} {(.git/HEAD)})
    (C {(git)} {(update-ref)} {(-d)} {($ VSub_Name "$m")})
    (C {(test_expect_success)} {(SQ <"update-ref -d is not confused by self-reference">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref refs/heads/self refs/heads/self &&\n"> 
          <"\ttest_when_finished \"rm -f .git/refs/heads/self\" &&\n"> <"\ttest_path_is_file .git/refs/heads/self &&\n"> 
          <"\ttest_must_fail git update-ref -d refs/heads/self &&\n"> <"\ttest_path_is_file .git/refs/heads/self\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"update-ref --no-deref -d can delete self-reference">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref refs/heads/self refs/heads/self &&\n"> 
          <"\ttest_when_finished \"rm -f .git/refs/heads/self\" &&\n"> <"\ttest_path_is_file .git/refs/heads/self &&\n"> 
          <"\tgit update-ref --no-deref -d refs/heads/self &&\n"> <"\ttest_path_is_missing .git/refs/heads/self\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"update-ref --no-deref -d can delete reference to bad ref">)} 
      {
        (SQ <"\n"> <"\t>.git/refs/heads/bad &&\n"> 
          <"\ttest_when_finished \"rm -f .git/refs/heads/bad\" &&\n"> <"\tgit symbolic-ref refs/heads/ref-to-bad refs/heads/bad &&\n"> 
          <"\ttest_when_finished \"rm -f .git/refs/heads/ref-to-bad\" &&\n"> <"\ttest_path_is_file .git/refs/heads/ref-to-bad &&\n"> 
          <"\tgit update-ref --no-deref -d refs/heads/ref-to-bad &&\n"> <"\ttest_path_is_missing .git/refs/heads/ref-to-bad\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"(not) create HEAD with old sha1">)} 
      {
        (DQ ("\n") ("\ttest_must_fail git update-ref HEAD ") ($ VSub_Name "$A") (" ") ($ VSub_Name "$B") 
          ("\n")
        )
      }
    )
    (C {(test_expect_success)} {(DQ ("(not) prior created .git/") ($ VSub_Name "$m"))} 
      {(DQ ("\n") ("\t! test -f .git/") ($ VSub_Name "$m") ("\n"))}
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(test_expect_success)} {(DQ ("create HEAD"))} {(DQ ("git update-ref HEAD ") ($ VSub_Name "$A"))})
    (C {(test_expect_success)} {(SQ <"(not) change HEAD with wrong SHA1">)} 
      {
        (DQ ("\n") ("\ttest_must_fail git update-ref HEAD ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$Z") 
          ("\n")
        )
      }
    )
    (C {(test_expect_success)} {(DQ ("(not) changed .git/") ($ VSub_Name "$m"))} 
      {(DQ ("\n") ("\t! test ") ($ VSub_Name "$B")) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) 
        (SQ <")\n">)
      }
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")})
    (C {(rm)} {(-f)} {(.git/logs/refs/heads/master)})
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m") (" (logged by touch)"))} 
      {
        (SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:30\" \\\n"> 
          <"\t git update-ref --create-reflog HEAD ">
        ) (DQ ($ VSub_Name "$A")) (SQ <" -m \"Initial Creation\" &&\n"> <"\t test ">) (DQ ($ VSub_Name "$A")) 
        (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("update ") ($ VSub_Name "$m") (" (logged by touch)"))} 
      {(SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:31\" \\\n"> <"\t git update-ref HEAD">) 
        (DQ (" ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" ")) (SQ <"-m \"Switch\" &&\n"> <"\t test ">) (DQ ($ VSub_Name "$B")) (SQ <" = $(cat .git/">) 
        (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("set ") ($ VSub_Name "$m") (" (logged by touch)"))} 
      {(SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:41\" \\\n"> <"\t git update-ref HEAD">) 
        (DQ (" ") ($ VSub_Name "$A") (" &&\n") ("\t test ") ($ VSub_Name "$A")) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[783])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ($ VSub_Name "$Z") (" ") ($ VSub_Name "$A") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") 
                (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150200 +0000\tInitial Creation\n") ($ VSub_Name "$A") (" ") 
                ($ VSub_Name "$B") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") 
                ("> 1117150260 +0000\tSwitch\n") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") 
                ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150860 +0000\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [786]
        )
      ]
    )
    (C {(test_expect_success)} {(DQ ("verifying ") ($ VSub_Name "$m") ("'s log"))} 
      {(DQ ("test_cmp expect .git/logs/") ($ VSub_Name "$m"))}
    )
    (C {(rm)} {(-rf)} {(.git/) ($ VSub_Name "$m")} {(.git/logs)} {(expect)})
    (C {(test_expect_success)} {(SQ <"enable core.logAllRefUpdates">)} 
      {
        (SQ <"git config core.logAllRefUpdates true &&\n"> 
          <"\t test true = $(git config --bool --get core.logAllRefUpdates)">
        )
      }
    )
    (C {(test_expect_success)} {(DQ ("create ") ($ VSub_Name "$m") (" (logged by config)"))} 
      {(SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:32\" \\\n"> <"\t git update-ref HEAD">) 
        (DQ (" ") ($ VSub_Name "$A") (" ")) (SQ <"-m \"Initial Creation\" &&\n"> <"\t test ">) (DQ ($ VSub_Name "$A")) (SQ <" = $(cat .git/">) 
        (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("update ") ($ VSub_Name "$m") (" (logged by config)"))} 
      {(SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:33\" \\\n"> <"\t git update-ref HEAD">) 
        (DQ (" ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" ")) (SQ <"-m \"Switch\" &&\n"> <"\t test ">) (DQ ($ VSub_Name "$B")) (SQ <" = $(cat .git/">) 
        (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (C {(test_expect_success)} {(DQ ("set ") ($ VSub_Name "$m") (" (logged by config)"))} 
      {(SQ <"GIT_COMMITTER_DATE=\"2005-05-26 23:43\" \\\n"> <"\t git update-ref HEAD ">) 
        (DQ ($ VSub_Name "$A") (" &&\n") ("\t test ") ($ VSub_Name "$A")) (SQ <" = $(cat .git/">) (DQ ($ VSub_Name "$m")) (SQ <")">)
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[971])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ($ VSub_Name "$Z") (" ") ($ VSub_Name "$A") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") 
                (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150320 +0000\tInitial Creation\n") ($ VSub_Name "$A") (" ") 
                ($ VSub_Name "$B") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") 
                ("> 1117150380 +0000\tSwitch\n") ($ VSub_Name "$B") (" ") ($ VSub_Name "$A") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") 
                ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150980 +0000\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [974]
        )
      ]
    )
    (C {(test_expect_success)} {(DQ ("verifying ") ($ VSub_Name "$m") ("'s log"))} 
      {(SQ <"test_cmp expect .git/logs/$m">)}
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")} {(.git/logs/) ($ VSub_Name "$m")} {(expect)})
    (C {(git)} {(update-ref)} {($ VSub_Name "$m")} {($ VSub_Name "$D")})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir
          op_id: Redir_Great
          fd: -1
          arg_word: {(.git/logs/) ($ VSub_Name "$m")}
          spids: [1040]
        )
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("0000000000000000000000000000000000000000 ") ($ VSub_Name "$C") (" ") 
                ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150320 -0500\n") ($ VSub_Name "$C") (" ") 
                ($ VSub_Name "$A") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") 
                ("> 1117150350 -0500\n") ($ VSub_Name "$A") (" ") ($ VSub_Name "$B") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") 
                ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150380 -0500\n") ($ VSub_Name "$F") (" ") ($ VSub_Name "$Z") (" ") 
                ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150680 -0500\n") ($ VSub_Name "$Z") (" ") 
                ($ VSub_Name "$E") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") 
                ("> 1117150980 -0500\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1044]
        )
      ]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:ed)
          op: Equal
          rhs: {(DQ ("Thu, 26 May 2005 18:32:00 -0500"))}
          spids: [1087]
        )
      ]
      spids: [1087]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:gd)
          op: Equal
          rhs: {(DQ ("Thu, 26 May 2005 18:33:00 -0500"))}
          spids: [1092]
        )
      ]
      spids: [1092]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:ld)
          op: Equal
          rhs: {(DQ ("Thu, 26 May 2005 18:43:00 -0500"))}
          spids: [1097]
        )
      ]
      spids: [1097]
    )
    (C {(test_expect_success)} {(SQ <"Query \"master@{May 25 2005}\" (before history)">)} 
      {
        (SQ <"rm -f o e &&\n"> <"\t git rev-parse --verify \"master@{May 25 2005}\" >o 2>e &&\n"> 
          <"\t test ">
        ) (DQ ($ VSub_Name "$C")) (SQ <" = $(cat o) &&\n"> <"\t test \"warning: Log for ">) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (master) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <" only goes back to $ed.\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} {(DQ ("Query master@{2005-05-25} (before history)"))} 
      {
        (SQ <"rm -f o e &&\n"> <"\t git rev-parse --verify master@{2005-05-25} >o 2>e &&\n"> 
          <"\t test ">
        ) (DQ ($ VSub_Name "$C")) (SQ <" = $(cat o) &&\n"> <"\t echo test \"warning: Log for ">) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (master) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <" only goes back to $ed.\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"Query \"master@{May 26 2005 23:31:59}\" (1 second before history)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{May 26 2005 23:31:59}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$C")) (SQ <" = $(cat o) &&\n"> <"\t test \"warning: Log for ">) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <master>) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <" only goes back to $ed.\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"Query \"master@{May 26 2005 23:32:00}\" (exactly history start)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{May 26 2005 23:32:00}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$C")) (SQ <" = $(cat o) &&\n"> <"\t test \"\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"Query \"master@{May 26 2005 23:32:30}\" (first non-creation change)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{May 26 2005 23:32:30}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$A")) (SQ <" = $(cat o) &&\n"> <"\t test \"\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"Query \"master@{2005-05-26 23:33:01}\" (middle of history with gap)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{2005-05-26 23:33:01}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$B")) (SQ <" = $(cat o) &&\n"> <"\t test \"warning: Log for ref ">) 
        (DQ ($ VSub_Name "$m") (" has gap after ") ($ VSub_Name "$gd")) (SQ <".\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} {(SQ <"Query \"master@{2005-05-26 23:38:00}\" (middle of history)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{2005-05-26 23:38:00}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$Z")) (SQ <" = $(cat o) &&\n"> <"\t test \"\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} {(SQ <"Query \"master@{2005-05-26 23:43:00}\" (exact end of history)">)} 
      {
        (SQ <"rm -f o e &&\n"> 
          <"\t git rev-parse --verify \"master@{2005-05-26 23:43:00}\" >o 2>e &&\n"> <"\t test ">
        ) (DQ ($ VSub_Name "$E")) (SQ <" = $(cat o) &&\n"> <"\t test \"\" = \"$(cat e)\"">)
      }
    )
    (C {(test_expect_success)} {(SQ <"Query \"master@{2005-05-28}\" (past end of history)">)} 
      {
        (SQ <"rm -f o e &&\n"> <"\t git rev-parse --verify \"master@{2005-05-28}\" >o 2>e &&\n"> 
          <"\t test ">
        ) (DQ ($ VSub_Name "$D")) (SQ <" = $(cat o) &&\n"> <"\t test \"warning: Log for ref ">) 
        (DQ ($ VSub_Name "$m") (" unexpectedly ended on ") ($ VSub_Name "$ld")) (SQ <".\" = \"$(cat e)\"">)
      }
    )
    (C {(rm)} {(-f)} {(.git/) ($ VSub_Name "$m")} {(.git/logs/) ($ VSub_Name "$m")} {(expect)})
    (C {(test_expect_success)} {(SQ <"creating initial files">)} 
      {
        (SQ <"echo TEST >F &&\n"> <"     git add F &&\n"> 
          <"\t GIT_AUTHOR_DATE=\"2005-05-26 23:30\" \\\n"> <"\t GIT_COMMITTER_DATE=\"2005-05-26 23:30\" git commit -m add -a &&\n"> 
          <"\t h_TEST=$(git rev-parse --verify HEAD) &&\n"> <"\t echo The other day this did not work. >M &&\n"> 
          <"\t echo And then Bob told me how to fix it. >>M &&\n"> <"\t echo OTHER >F &&\n"> <"\t GIT_AUTHOR_DATE=\"2005-05-26 23:41\" \\\n"> 
          <"\t GIT_COMMITTER_DATE=\"2005-05-26 23:41\" git commit -F M -a &&\n"> <"\t h_OTHER=$(git rev-parse --verify HEAD) &&\n"> <"\t GIT_AUTHOR_DATE=\"2005-05-26 23:44\" \\\n"> 
          <"\t GIT_COMMITTER_DATE=\"2005-05-26 23:44\" git commit --amend &&\n"> <"\t h_FIXED=$(git rev-parse --verify HEAD) &&\n"> 
          <"\t echo Merged initial commit and a later commit. >M &&\n"> <"\t echo $h_TEST >.git/MERGE_HEAD &&\n"> <"\t GIT_AUTHOR_DATE=\"2005-05-26 23:45\" \\\n"> 
          <"\t GIT_COMMITTER_DATE=\"2005-05-26 23:45\" git commit -F M &&\n"> <"\t h_MERGED=$(git rev-parse --verify HEAD) &&\n"> <"\t rm -f M">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[1396])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ($ VSub_Name "$Z") (" ") ($ VSub_Name "$h_TEST") (" ") 
                ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150200 +0000\tcommit (initial): add\n") 
                ($ VSub_Name "$h_TEST") (" ") ($ VSub_Name "$h_OTHER") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") 
                ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117150860 +0000\tcommit: The other day this did not work.\n") ($ VSub_Name "$h_OTHER") (" ") 
                ($ VSub_Name "$h_FIXED") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") ($ VSub_Name "$GIT_COMMITTER_EMAIL") 
                ("> 1117151040 +0000\tcommit (amend): The other day this did not work.\n") ($ VSub_Name "$h_FIXED") (" ") ($ VSub_Name "$h_MERGED") (" ") ($ VSub_Name "$GIT_COMMITTER_NAME") (" <") 
                ($ VSub_Name "$GIT_COMMITTER_EMAIL") ("> 1117151100 +0000\tcommit (merge): Merged initial commit and a later commit.\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [1399]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"git commit logged updates">)} 
      {(DQ ("test_cmp expect .git/logs/") ($ VSub_Name "$m"))}
    )
    (C {(unset)} {(h_TEST)} {(h_OTHER)} {(h_FIXED)} {(h_MERGED)})
    (C {(test_expect_success)} {(SQ <"git cat-file blob master:F (expect OTHER)">)} 
      {(SQ <"test OTHER = $(git cat-file blob master:F)">)}
    )
    (C {(test_expect_success)} {(SQ <"git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)">)} 
      {(SQ <"test TEST = $(git cat-file blob \"master@{2005-05-26 23:30}:F\")">)}
    )
    (C {(test_expect_success)} {(SQ <"git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)">)} 
      {(SQ <"test OTHER = $(git cat-file blob \"master@{2005-05-26 23:42}:F\")">)}
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:a) op:Equal rhs:{(refs/heads/a)} spids:[1503])]
      spids: [1503]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:b) op:Equal rhs:{(refs/heads/b)} spids:[1506])]
      spids: [1506]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:c) op:Equal rhs:{(refs/heads/c)} spids:[1509])]
      spids: [1509]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:E) op:Equal rhs:{(SQ <"\"\"">)} spids:[1512])]
      spids: [1512]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:F) op:Equal rhs:{(SQ <"%s\\0">)} spids:[1517])]
      spids: [1517]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:pws)
          op: Equal
          rhs: {(SQ <"path with space">)}
          spids: [1522]
        )
      ]
      spids: [1522]
    )
    (C {(test_expect_success)} {(SQ <"stdin test setup">)} 
      {
        (SQ <"\n"> <"\techo \"$pws\" >\"$pws\" &&\n"> <"\tgit add -- \"$pws\" &&\n"> 
          <"\tgit commit -m \"$pws\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"-z fails without --stdin">)} 
      {
        (SQ <"\n"> <"\ttest_must_fail git update-ref -z $m $m $m 2>err &&\n"> 
          <"\ttest_i18ngrep \"usage: git update-ref\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin works with no input">)} 
      {
        (SQ <"\n"> <"\t>stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\tgit rev-parse --verify -q $m\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on empty line">)} 
      {
        (SQ <"\n"> <"\techo \"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: empty command in input\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on only whitespace">)} 
      {
        (SQ <"\n"> <"\techo \" \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: whitespace before command:  \" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on leading whitespace">)} 
      {
        (SQ <"\n"> <"\techo \" create $a $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: whitespace before command:  create $a $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on unknown command">)} 
      {
        (SQ <"\n"> <"\techo \"unknown $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: unknown $a\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on unbalanced quotes">)} 
      {
        (SQ <"\n"> <"\techo \"create $a \\\"master\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: badly quoted argument: \\\\\\\"master\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on invalid escape">)} 
      {
        (SQ <"\n"> <"\techo \"create $a \\\"ma\\zter\\\"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: badly quoted argument: \\\\\\\"ma\\\\\\\\zter\\\\\\\"\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails on junk after quoted argument">)} 
      {
        (SQ <"\n"> <"\techo \"create \\\"$a\\\"master\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unexpected character after quoted argument: \\\\\\\"$a\\\\\\\"master\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails create with no ref">)} 
      {
        (SQ <"\n"> <"\techo \"create \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails create with no new value">)} 
      {
        (SQ <"\n"> <"\techo \"create $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $a: missing <newvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails create with too many arguments">)} 
      {
        (SQ <"\n"> <"\techo \"create $a $m $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $a: extra input:  $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails update with no ref">)} 
      {
        (SQ <"\n"> <"\techo \"update \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails update with no new value">)} 
      {
        (SQ <"\n"> <"\techo \"update $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $a: missing <newvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails update with too many arguments">)} 
      {
        (SQ <"\n"> <"\techo \"update $a $m $m $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $a: extra input:  $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails delete with no ref">)} 
      {
        (SQ <"\n"> <"\techo \"delete \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails delete with too many arguments">)} 
      {
        (SQ <"\n"> <"\techo \"delete $a $m $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete $a: extra input:  $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails verify with too many arguments">)} 
      {
        (SQ <"\n"> <"\techo \"verify $a $m $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: verify $a: extra input:  $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails option with unknown name">)} 
      {
        (SQ <"\n"> <"\techo \"option unknown\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: option unknown: unknown\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin fails with duplicate refs">)} 
      {
        (SQ <"\n"> <"\tcat >stdin <<-EOF &&\n"> <"\tcreate $a $m\n"> <"\tcreate $b $m\n"> 
          <"\tcreate $a $m\n"> <"\tEOF\n"> <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> 
          <"\tgrep \"fatal: multiple updates for ref ">
        ) (DQ ("'")) (SQ <"$a">) (DQ ("'")) (SQ <" not allowed.\" err\n">)
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin create ref works">)} 
      {
        (SQ <"\n"> <"\techo \"create $a $m\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin does not create reflogs by default">)} 
      {
        (SQ <"\n"> <"\ttest_when_finished \"git update-ref -d $outside\" &&\n"> 
          <"\techo \"create $outside $m\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $outside >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest_must_fail git reflog exists $outside\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin creates reflogs with --create-reflog">)} 
      {
        (SQ <"\n"> <"\techo \"create $outside $m\" >stdin &&\n"> 
          <"\tgit update-ref --create-reflog --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $outside >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit reflog exists $outside\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin succeeds with quoted argument">)} 
      {
        (SQ <"\n"> <"\tgit update-ref -d $a &&\n"> <"\techo \"create $a \\\"$m\\\"\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin succeeds with escaped character">)} 
      {
        (SQ <"\n"> <"\tgit update-ref -d $a &&\n"> 
          <"\techo \"create $a \\\"ma\\\\163ter\\\"\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update ref creates with zero old value">)} 
      {
        (SQ <"\n"> <"\techo \"update $b $m $Z\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit update-ref -d $b\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update ref creates with empty old value">)} 
      {
        (SQ <"\n"> <"\techo \"update $b $m $E\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin create ref works with path with space to blob">)} 
      {
        (SQ <"\n"> <"\techo \"create refs/blobs/pws \\\"$m:$pws\\\"\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse \"$m:$pws\" >expect &&\n"> <"\tgit rev-parse refs/blobs/pws >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit update-ref -d refs/blobs/pws\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update ref fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\techo \"update $c $m $m~1\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$c">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\ttest_must_fail git rev-parse --verify -q $c\n">)
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update ref fails with bad old value">)} 
      {
        (SQ <"\n"> <"\techo \"update $c $m does-not-exist\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $c: invalid <oldvalue>: does-not-exist\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin create ref fails with bad new value">)} 
      {
        (SQ <"\n"> <"\techo \"create $c does-not-exist\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $c: invalid <newvalue>: does-not-exist\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin create ref fails with zero new value">)} 
      {
        (SQ <"\n"> <"\techo \"create $c \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $c: zero <newvalue>\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update ref works with right old value">)} 
      {
        (SQ <"\n"> <"\techo \"update $b $m~1 $m\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m~1 >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin delete ref fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\techo \"delete $a $m~1\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$a">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin delete ref fails with zero old value">)} 
      {
        (SQ <"\n"> <"\techo \"delete $a \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete $a: zero <oldvalue>\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update symref works option no-deref">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref TESTSYMREF $b &&\n"> <"\tcat >stdin <<-EOF &&\n"> 
          <"\toption no-deref\n"> <"\tupdate TESTSYMREF $a $b\n"> <"\tEOF\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\tgit rev-parse TESTSYMREF >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\tgit rev-parse $m~1 >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin delete symref works option no-deref">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref TESTSYMREF $b &&\n"> <"\tcat >stdin <<-EOF &&\n"> 
          <"\toption no-deref\n"> <"\tdelete TESTSYMREF $b\n"> <"\tEOF\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q TESTSYMREF &&\n"> <"\tgit rev-parse $m~1 >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin delete ref works with right old value">)} 
      {
        (SQ <"\n"> <"\techo \"delete $b $m~1\" >stdin &&\n"> <"\tgit update-ref --stdin <stdin &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $b\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update/create/verify combination works">)} 
      {
        (SQ <"\n"> <"\tcat >stdin <<-EOF &&\n"> <"\tupdate $a $m\n"> <"\tcreate $b $m\n"> 
          <"\tverify $c\n"> <"\tEOF\n"> <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify succeeds for correct value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> <"\techo \"verify $m $m\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify succeeds for missing reference">)} 
      {
        (SQ <"\n"> <"\techo \"verify refs/heads/missing $Z\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q refs/heads/missing\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify treats no value as missing">)} 
      {
        (SQ <"\n"> <"\techo \"verify refs/heads/missing\" >stdin &&\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q refs/heads/missing\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify fails for wrong value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> <"\techo \"verify $m $m~1\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify fails for mistaken null value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> <"\techo \"verify $m $Z\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin verify fails for mistaken empty value">)} 
      {
        (SQ <"\n"> <"\tM=$(git rev-parse $m) &&\n"> 
          <"\ttest_when_finished \"git update-ref $m $M\" &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\techo \"verify $m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update refs works with identity updates">)} 
      {
        (SQ <"\n"> <"\tcat >stdin <<-EOF &&\n"> <"\tupdate $a $m $m\n"> <"\tupdate $b $m $m\n"> 
          <"\tupdate $c $Z $E\n"> <"\tEOF\n"> <"\tgit update-ref --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin update refs fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\tgit update-ref $c $m &&\n"> <"\tcat >stdin <<-EOF &&\n"> <"\tupdate $a $m $m\n"> 
          <"\tupdate $b $m $m\n"> <"\tupdate $c  ">
        ) 
        (SQ <"\n"> <"\tEOF\n"> <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> 
          <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$c">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\tgit rev-parse $c >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin delete refs works with packed and loose refs">)} 
      {
        (SQ <"\n"> <"\tgit pack-refs --all &&\n"> <"\tgit update-ref $c $m~1 &&\n"> 
          <"\tcat >stdin <<-EOF &&\n"> <"\tdelete $a $m\n"> <"\tupdate $b $Z $m\n"> <"\tupdate $c $E $m~1\n"> <"\tEOF\n"> 
          <"\tgit update-ref --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q $a &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $b &&\n"> <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z works on empty input">)} 
      {
        (SQ <"\n"> <"\t>stdin &&\n"> <"\tgit update-ref -z --stdin <stdin &&\n"> 
          <"\tgit rev-parse --verify -q $m\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails on empty line">)} 
      {
        (SQ <"\n"> <"\techo \"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: whitespace before command: \" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails on empty command">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: empty command in input\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails on only whitespace">)} 
      {
        (SQ <"\n"> <"\tprintf $F \" \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: whitespace before command:  \" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails on leading whitespace">)} 
      {
        (SQ <"\n"> <"\tprintf $F \" create $a\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: whitespace before command:  create $a\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails on unknown command">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"unknown $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: unknown $a\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails create with no ref">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails create with no new value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $a: unexpected end of input when reading <newvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails create with too many arguments">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create $a\" \"$m\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails update with no ref">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails update with too few args">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $a\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $a: unexpected end of input when reading <oldvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z emits warning with empty new value">)} 
      {
        (SQ <"\n"> <"\tgit update-ref $a $m &&\n"> <"\tprintf $F \"update $a\" \"\" \"\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"warning: update $a: missing <newvalue>, treating as zero\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $a\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails update with no new value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $a: unexpected end of input when reading <newvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails update with no old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $a\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $a: unexpected end of input when reading <oldvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails update with too many arguments">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $a\" \"$m\" \"$m\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails delete with no ref">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete \" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete: missing <ref>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails delete with no old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete $a: unexpected end of input when reading <oldvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails delete with too many arguments">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete $a\" \"$m\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails verify with too many arguments">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"verify $a\" \"$m\" \"$m\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: unknown command: $m\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails verify with no old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"verify $a\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: verify $a: unexpected end of input when reading <oldvalue>\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails option with unknown name">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"option unknown\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: option unknown: unknown\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z fails with duplicate refs">)} 
      {
        (SQ <"\n"> 
          <
"\tprintf $F \"create $a\" \"$m\" \"create $b\" \"$m\" \"create $a\" \"$m\" >stdin &&\n"
          > <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> 
          <"\tgrep \"fatal: multiple updates for ref ">
        ) (DQ ("'")) (SQ <"$a">) (DQ ("'")) (SQ <" not allowed.\" err\n">)
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z create ref works">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create $a\" \"$m\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update ref creates with zero old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $b\" \"$m\" \"$Z\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit update-ref -d $b\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update ref creates with empty old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $b\" \"$m\" \"\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z create ref works with path with space to blob">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create refs/blobs/pws\" \"$m:$pws\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse \"$m:$pws\" >expect &&\n"> <"\tgit rev-parse refs/blobs/pws >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit update-ref -d refs/blobs/pws\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update ref fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $c\" \"$m\" \"$m~1\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$c">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\ttest_must_fail git rev-parse --verify -q $c\n">)
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update ref fails with bad old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $c\" \"$m\" \"does-not-exist\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: update $c: invalid <oldvalue>: does-not-exist\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z create ref fails when ref exists">)} 
      {
        (SQ <"\n"> <"\tgit update-ref $c $m &&\n"> <"\tgit rev-parse \"$c\" >expect &&\n"> 
          <"\tprintf $F \"create $c\" \"$m~1\" >stdin &&\n"> <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$c">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\tgit rev-parse \"$c\" >actual &&\n"> <"\ttest_cmp expect actual\n">)
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z create ref fails with bad new value">)} 
      {
        (SQ <"\n"> <"\tgit update-ref -d \"$c\" &&\n"> 
          <"\tprintf $F \"create $c\" \"does-not-exist\" >stdin &&\n"> <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> 
          <"\tgrep \"fatal: create $c: invalid <newvalue>: does-not-exist\" err &&\n"> <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z create ref fails with empty new value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"create $c\" \"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: create $c: missing <newvalue>\" err &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update ref works with right old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"update $b\" \"$m~1\" \"$m\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m~1 >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z delete ref fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete $a\" \"$m~1\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$a">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z delete ref fails with zero old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete $a\" \"$Z\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: delete $a: zero <oldvalue>\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update symref works option no-deref">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref TESTSYMREF $b &&\n"> 
          <"\tprintf $F \"option no-deref\" \"update TESTSYMREF\" \"$a\" \"$b\" >stdin &&\n"> <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse TESTSYMREF >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $m~1 >expect &&\n"> 
          <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z delete symref works option no-deref">)} 
      {
        (SQ <"\n"> <"\tgit symbolic-ref TESTSYMREF $b &&\n"> 
          <"\tprintf $F \"option no-deref\" \"delete TESTSYMREF\" \"$b\" >stdin &&\n"> <"\tgit update-ref -z --stdin <stdin &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q TESTSYMREF &&\n"> <"\tgit rev-parse $m~1 >expect &&\n"> <"\tgit rev-parse $b >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z delete ref works with right old value">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"delete $b\" \"$m~1\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q $b\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update/create/verify combination works">)} 
      {
        (SQ <"\n"> 
          <
"\tprintf $F \"update $a\" \"$m\" \"\" \"create $b\" \"$m\" \"verify $c\" \"\" >stdin &&\n"
          > <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify succeeds for correct value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tprintf $F \"verify $m\" \"$m\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify succeeds for missing reference">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"verify refs/heads/missing\" \"$Z\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q refs/heads/missing\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify treats no value as missing">)} 
      {
        (SQ <"\n"> <"\tprintf $F \"verify refs/heads/missing\" \"\" >stdin &&\n"> 
          <"\tgit update-ref -z --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q refs/heads/missing\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify fails for wrong value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tprintf $F \"verify $m\" \"$m~1\" >stdin &&\n"> <"\ttest_must_fail git update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify fails for mistaken null value">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tprintf $F \"verify $m\" \"$Z\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z verify fails for mistaken empty value">)} 
      {
        (SQ <"\n"> <"\tM=$(git rev-parse $m) &&\n"> 
          <"\ttest_when_finished \"git update-ref $m $M\" &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tprintf $F \"verify $m\" \"\" >stdin &&\n"> 
          <"\ttest_must_fail git update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update refs works with identity updates">)} 
      {
        (SQ <"\n"> 
          <
"\tprintf $F \"update $a\" \"$m\" \"$m\" \"update $b\" \"$m\" \"$m\" \"update $c\" \"$Z\" \"\" >stdin &&\n"
          > <"\tgit update-ref -z --stdin <stdin &&\n"> <"\tgit rev-parse $m >expect &&\n"> 
          <"\tgit rev-parse $a >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z update refs fails with wrong old value">)} 
      {
        (SQ <"\n"> <"\tgit update-ref $c $m &&\n"> 
          <
"\tprintf $F \"update $a\" \"$m\" \"$m\" \"update $b\" \"$m\" \"$m\" \"update $c\" \"$m\" \"$Z\" >stdin &&\n"
          > <"\ttest_must_fail git update-ref -z --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: cannot lock ref ">
        ) (DQ ("'")) (SQ <"$c">) (DQ ("'")) 
        (SQ <"\" err &&\n"> <"\tgit rev-parse $m >expect &&\n"> <"\tgit rev-parse $a >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\tgit rev-parse $b >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\tgit rev-parse $c >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"stdin -z delete refs works with packed and loose refs">)} 
      {
        (SQ <"\n"> <"\tgit pack-refs --all &&\n"> <"\tgit update-ref $c $m~1 &&\n"> 
          <
"\tprintf $F \"delete $a\" \"$m\" \"update $b\" \"$Z\" \"$m\" \"update $c\" \"\" \"$m~1\" >stdin &&\n"
          > <"\tgit update-ref -z --stdin <stdin &&\n"> <"\ttest_must_fail git rev-parse --verify -q $a &&\n"> 
          <"\ttest_must_fail git rev-parse --verify -q $b &&\n"> <"\ttest_must_fail git rev-parse --verify -q $c\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"fails with duplicate HEAD update">)} 
      {
        (SQ <"\n"> <"\tgit branch target1 $A &&\n"> <"\tgit checkout target1 &&\n"> 
          <"\tcat >stdin <<-EOF &&\n"> <"\tupdate refs/heads/target1 $C\n"> <"\toption no-deref\n"> <"\tupdate HEAD $B\n"> <"\tEOF\n"> 
          <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> <"\tgrep \"fatal: multiple updates for ">
        ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <HEAD>) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <" (including one via its referent .refs/heads/target1.) are not allowed\" err &&\n"> 
          <"\techo \"refs/heads/target1\" >expect &&\n"> <"\tgit symbolic-ref HEAD >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\techo \"$A\" >expect &&\n"> <"\tgit rev-parse refs/heads/target1 >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"fails with duplicate ref update via symref">)} 
      {
        (SQ <"\n"> <"\tgit branch target2 $A &&\n"> 
          <"\tgit symbolic-ref refs/heads/symref2 refs/heads/target2 &&\n"> <"\tcat >stdin <<-EOF &&\n"> <"\tupdate refs/heads/target2 $C\n"> <"\tupdate refs/heads/symref2 $B\n"> 
          <"\tEOF\n"> <"\ttest_must_fail git update-ref --stdin <stdin 2>err &&\n"> 
          <"\tgrep \"fatal: multiple updates for ">
        ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <refs/heads/target2>) 
        (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
        (SQ <" (including one via symref .refs/heads/symref2.) are not allowed\" err &&\n"> 
          <"\techo \"refs/heads/target2\" >expect &&\n"> <"\tgit symbolic-ref refs/heads/symref2 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> 
          <"\techo \"$A\" >expect &&\n"> <"\tgit rev-parse refs/heads/target2 >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (FuncDef
      name: run_with_limited_open_files
      body: 
        (BraceGroup
          children: [
            (Subshell
              child: 
                (AndOr
                  children: [(C {(ulimit)} {(-n)} {(32)}) (C {(DQ ($ VSub_At "$@"))})]
                  op_id: Op_DAmp
                )
              spids: [3231 3243]
            )
          ]
          spids: [3228]
        )
      spids: [3223 3227]
    )
    (C {(test_lazy_prereq)} {(ULIMIT_FILE_DESCRIPTORS)} {(SQ <"run_with_limited_open_files true">)})
    (C {(test_expect_success)} {(ULIMIT_FILE_DESCRIPTORS)} 
      {(SQ <"large transaction creating branches does not burst open file limit">)} 
      {
        (SQ <"\n"> <"(\n"> <"\tfor i in $(test_seq 33)\n"> <"\tdo\n"> 
          <"\t\techo \"create refs/heads/$i HEAD\"\n"> <"\tdone >large_input &&\n"> 
          <"\trun_with_limited_open_files git update-ref --stdin <large_input &&\n"> <"\tgit rev-parse --verify -q refs/heads/33\n"> <")\n">
        )
      }
    )
    (C {(test_expect_success)} {(ULIMIT_FILE_DESCRIPTORS)} 
      {(SQ <"large transaction deleting branches does not burst open file limit">)} 
      {
        (SQ <"\n"> <"(\n"> <"\tfor i in $(test_seq 33)\n"> <"\tdo\n"> 
          <"\t\techo \"delete refs/heads/$i HEAD\"\n"> <"\tdone >large_input &&\n"> 
          <"\trun_with_limited_open_files git update-ref --stdin <large_input &&\n"> <"\ttest_must_fail git rev-parse --verify -q refs/heads/33\n"> <")\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"handle per-worktree refs in refs/bisect">)} 
      {
        (SQ <"\n"> <"\tgit commit --allow-empty -m \"initial commit\" &&\n"> 
          <"\tgit worktree add -b branch worktree &&\n"> <"\t(\n"> <"\t\tcd worktree &&\n"> <"\t\tgit commit --allow-empty -m \"test commit\"  &&\n"> 
          <"\t\tgit for-each-ref >for-each-ref.out &&\n"> <"\t\t! grep refs/bisect for-each-ref.out &&\n"> 
          <"\t\tgit update-ref refs/bisect/something HEAD &&\n"> <"\t\tgit rev-parse refs/bisect/something >../worktree-head &&\n"> 
          <"\t\tgit for-each-ref | grep refs/bisect/something\n"> <"\t) &&\n"> <"\ttest_path_is_missing .git/refs/bisect &&\n"> 
          <"\ttest_must_fail git rev-parse refs/bisect/something &&\n"> <"\tgit update-ref refs/bisect/something HEAD &&\n"> 
          <"\tgit rev-parse refs/bisect/something >main-head &&\n"> <"\t! test_cmp main-head worktree-head\n">
        )
      }
    )
    (C {(test_done)})
  ]
)