(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'check that read-tree rejects confusing paths'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {(SQ <'create base tree'>)} 
      {
        (SQ <'\n'> <'\techo content >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m base &&\n'> 
          <'\tblob=$(git rev-parse HEAD:file) &&\n'> <'\ttree=$(git rev-parse HEAD^{tree})\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'enable core.protectHFS for rejection tests'>)} 
      {(SQ <'\n'> <'\tgit config core.protectHFS true\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'enable core.protectNTFS for rejection tests'>)} 
      {(SQ <'\n'> <'\tgit config core.protectNTFS true\n'>)}
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: (C {<read>} {<path>} {<pretty>})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (C {<Id.Lit_Colon ':'>} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name pretty>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VTest_ColonEquals ':='>
                      arg_word: {($ Id.VSub_DollarName '$path')}
                    )
                )
              }
            )
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName '$path'))}
              arms: [
                (case_arm
                  pat_list: [{<Id.Lit_Star '*'> <SPACE>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:path)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name path>
                                  suffix_op: 
                                    (suffix_op.Unary
                                      tok: <Id.VOp1_Percent '%'>
                                      arg_word: {<SPACE>}
                                    )
                                ) <' '>
                              )
                            }
                          spids: [89]
                        )
                      ]
                    )
                  ]
                  spids: [84 86 100 -1]
                )
              ]
            )
            (C {<test_expect_success>} 
              {(DQ <'reject '> ($ Id.VSub_DollarName '$pretty') <' at end of path'>)} 
              {
                (SQ <'\n'> <'\t\tprintf "100644 blob %s\\t%s" "$blob" "$path" >tree &&\n'> 
                  <'\t\tbogus=$(git mktree <tree) &&\n'> <'\t\ttest_must_fail git read-tree $bogus\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} 
              {(DQ <'reject '> ($ Id.VSub_DollarName '$pretty') <' as subtree'>)} 
              {
                (SQ <'\n'> <'\t\tprintf "040000 tree %s\\t%s" "$tree" "$path" >tree &&\n'> 
                  <'\t\tbogus=$(git mktree <tree) &&\n'> <'\t\ttest_must_fail git read-tree $bogus\n'> <'\t'>
                )
              }
            )
          ]
        )
      redirects: [
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_span_id: 177
              stdin_parts: [
                <'.\n'>
                <'..\n'>
                <'.git\n'>
                <'.GIT\n'>
                (${ Id.VSub_Name u200c)
                <'.Git {u200c}.Git\n'>
                <.gI>
                (${ Id.VSub_Name u200c)
                <'T .gI{u200c}T\n'>
                <.GiT>
                (${ Id.VSub_Name u200c)
                <' .GiT{u200c}\n'>
                <'git~1\n'>
                <'.git.SPACE .git.{space}\n'>
                <.>
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                <.GIT>
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                <'foobar backslashes\n'>
                <.git>
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                <'foobar backslashes2\n'>
              ]
            )
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'utf-8 paths allowed with core.protectHFS off'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished "git read-tree HEAD" &&\n'> 
          <'\ttest_config core.protectHFS false &&\n'> <'\tprintf "100644 blob %s\\t%s" "$blob" ".gi${u200c}t" >tree &&\n'> <'\tok=$(git mktree <tree) &&\n'> 
          <'\tgit read-tree $ok\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)