(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'test worktree writing operations when skip-worktree is used'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\ttest_commit init &&\n'> <'\techo modified >> init.t &&\n'> <'\ttouch added &&\n'> 
          <'\tgit add init.t added &&\n'> <'\tgit commit -m "modified and added" &&\n'> <'\tgit tag top\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'read-tree updates worktree, absent case'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f top &&\n'> <'\tgit update-index --skip-worktree init.t &&\n'> 
          <'\trm init.t &&\n'> <'\tgit read-tree -m -u HEAD^ &&\n'> <'\techo init > expected &&\n'> <'\ttest_cmp expected init.t\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'read-tree updates worktree, dirty case'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f top &&\n'> <'\tgit update-index --skip-worktree init.t &&\n'> 
          <'\techo dirty >> init.t &&\n'> <'\ttest_must_fail git read-tree -m -u HEAD^ &&\n'> <'\tgrep -q dirty init.t &&\n'> 
          <'\ttest "$(git ls-files -t init.t)" = "S init.t" &&\n'> <'\tgit update-index --no-skip-worktree init.t\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'read-tree removes worktree, absent case'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f top &&\n'> <'\tgit update-index --skip-worktree added &&\n'> 
          <'\trm added &&\n'> <'\tgit read-tree -m -u HEAD^ &&\n'> <'\ttest ! -f added\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'read-tree removes worktree, dirty case'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f top &&\n'> <'\tgit update-index --skip-worktree added &&\n'> 
          <'\techo dirty >> added &&\n'> <'\ttest_must_fail git read-tree -m -u HEAD^ &&\n'> <'\tgrep -q dirty added &&\n'> 
          <'\ttest "$(git ls-files -t added)" = "S added" &&\n'> <'\tgit update-index --no-skip-worktree added\n'>
        )
      }
    )
    (command.ShFunction
      name: setup_absent
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [(C {<test>} {<-f>} {<1>}) (C {<rm>} {<1>})]
            )
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {<git>} {<update-index>} {<--remove>} {<1>})
                (C {<git>} {<update-index>} {<--add>} {<--cacheinfo>} {<100644>} 
                  {($ Id.VSub_DollarName '$EMPTY_BLOB')} {<1>}
                )
                (C {<git>} {<update-index>} {<--skip-worktree>} {<1>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_absent
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{<echo>} {(DQ <'100644 '> ($ Id.VSub_DollarName '$EMPTY_BLOB') <' 0\t1'>)}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})]
                  do_fork: T
                )
                (command.Simple
                  words: [{<git>} {<ls-files>} {<--stage>} {<1>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<result>})]
                  do_fork: T
                )
                (C {<test_cmp>} {<expected>} {<result>})
                (C {<test>} {<Id.KW_Bang '!'>} {<-f>} {<1>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: setup_dirty
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {<git>} {<update-index>} {<--force-remove>} {<1>})
                (command.Simple
                  words: [{<echo>} {<dirty>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<1>})]
                  do_fork: T
                )
                (C {<git>} {<update-index>} {<--add>} {<--cacheinfo>} {<100644>} 
                  {($ Id.VSub_DollarName '$EMPTY_BLOB')} {<1>}
                )
                (C {<git>} {<update-index>} {<--skip-worktree>} {<1>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_dirty
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{<echo>} {(DQ <'100644 '> ($ Id.VSub_DollarName '$EMPTY_BLOB') <' 0\t1'>)}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})]
                  do_fork: T
                )
                (command.Simple
                  words: [{<git>} {<ls-files>} {<--stage>} {<1>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<result>})]
                  do_fork: T
                )
                (C {<test_cmp>} {<expected>} {<result>})
                (command.Simple
                  words: [{<echo>} {<dirty>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})]
                  do_fork: T
                )
              ]
            )
            (C {<test_cmp>} {<expected>} {<1>})
          ]
        )
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_span_id: 361
              stdin_parts: [<'S 1\n'> <'H 2\n'> <'H init.t\n'> <'S sub/1\n'> <'H sub/2\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'index setup'>)} 
      {
        (SQ <'\n'> <'\tgit checkout -f init &&\n'> <'\tmkdir sub &&\n'> 
          <'\ttouch ./1 ./2 sub/1 sub/2 &&\n'> <'\tgit add 1 2 sub/1 sub/2 &&\n'> <'\tgit update-index --skip-worktree 1 sub/1 &&\n'> 
          <'\tgit ls-files -t > result &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'git-add ignores worktree content'>)} 
      {(SQ <'\n'> <'\tsetup_absent &&\n'> <'\tgit add 1 &&\n'> <'\ttest_absent\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'git-add ignores worktree content'>)} 
      {(SQ <'\n'> <'\tsetup_dirty &&\n'> <'\tgit add 1 &&\n'> <'\ttest_dirty\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'git-rm fails if worktree is dirty'>)} 
      {(SQ <'\n'> <'\tsetup_dirty &&\n'> <'\ttest_must_fail git rm 1 &&\n'> <'\ttest_dirty\n'>)}
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_span_id: 434
              stdin_parts: [<'Would remove expected\n'> <'Would remove result\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'git-clean, absent case'>)} 
      {
        (SQ <'\n'> <'\tsetup_absent &&\n'> <'\tgit clean -n > result &&\n'> 
          <'\ttest_i18ncmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'git-clean, dirty case'>)} 
      {
        (SQ <'\n'> <'\tsetup_dirty &&\n'> <'\tgit clean -n > result &&\n'> 
          <'\ttest_i18ncmp expected result\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)