(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[21]) op: Equal rhs: {(SQ <'test worktree writing operations when skip-worktree is used'>)} spids: [21] ) ] spids: [21] ) (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.FuncDef name: setup_absent body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(test)} {(-f)} {(1)}) (C {(rm)} {(1)})] ) (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(git)} {(update-index)} {(--remove)} {(1)}) (C {(git)} {(update-index)} {(--add)} {(--cacheinfo)} {(100644)} {($ VSub_Name '$EMPTY_BLOB')} {(1)} ) (C {(git)} {(update-index)} {(--skip-worktree)} {(1)}) ] ) ] spids: [122] ) spids: [118 121] ) (command.FuncDef name: test_absent body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(echo)} {(DQ ('100644 ') ($ VSub_Name '$EMPTY_BLOB') (' 0\t1'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (command.SimpleCommand words: [{(git)} {(ls-files)} {(--stage)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result)})] ) (C {(test_cmp)} {(expected)} {(result)}) (C {(test)} {(KW_Bang '!')} {(-f)} {(1)}) ] ) ] spids: [181] ) spids: [177 180] ) (command.FuncDef name: setup_dirty body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(git)} {(update-index)} {(--force-remove)} {(1)}) (command.SimpleCommand words: [{(echo)} {(dirty)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(1)})] ) (C {(git)} {(update-index)} {(--add)} {(--cacheinfo)} {(100644)} {($ VSub_Name '$EMPTY_BLOB')} {(1)} ) (C {(git)} {(update-index)} {(--skip-worktree)} {(1)}) ] ) ] spids: [238] ) spids: [234 237] ) (command.FuncDef name: test_dirty body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(echo)} {(DQ ('100644 ') ($ VSub_Name '$EMPTY_BLOB') (' 0\t1'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (command.SimpleCommand words: [{(git)} {(ls-files)} {(--stage)} {(1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result)})] ) (C {(test_cmp)} {(expected)} {(result)}) (command.SimpleCommand words: [{(echo)} {(dirty)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) ] ) (C {(test_cmp)} {(expected)} {(1)}) ] spids: [295] ) spids: [291 294] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 369 stdin_parts: [('S 1\n') ('H 2\n') ('H init.t\n') ('S sub/1\n') ('H sub/2\n')] ) ] ) (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.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 442 stdin_parts: [('Would remove expected\n') ('Would remove result\n')] ) ] ) (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)}) ] )