# Helper functions to check if read-tree would succeed/fail as expected with # and without the dry-run option. They also test that the dry-run does not # write the index and that together with -u it doesn't touch the work tree. # proc read_tree_must_succeed { git ls-files -s >pre-dry-run && git read-tree -n @Argv && git ls-files -s >post-dry-run && test_cmp pre-dry-run post-dry-run && git read-tree @Argv } proc read_tree_must_fail { git ls-files -s >pre-dry-run && test_must_fail git read-tree -n @Argv && git ls-files -s >post-dry-run && test_cmp pre-dry-run post-dry-run && test_must_fail git read-tree @Argv } proc read_tree_u_must_succeed { git ls-files -s >pre-dry-run && git diff-files -p >pre-dry-run-wt && git read-tree -n @Argv && git ls-files -s >post-dry-run && git diff-files -p >post-dry-run-wt && test_cmp pre-dry-run post-dry-run && test_cmp pre-dry-run-wt post-dry-run-wt && git read-tree @Argv } proc read_tree_u_must_fail { git ls-files -s >pre-dry-run && git diff-files -p >pre-dry-run-wt && test_must_fail git read-tree -n @Argv && git ls-files -s >post-dry-run && git diff-files -p >post-dry-run-wt && test_cmp pre-dry-run post-dry-run && test_cmp pre-dry-run-wt post-dry-run-wt && test_must_fail git read-tree @Argv } (CommandList children: [ (FuncDef name: read_tree_must_succeed body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre-dry-run)} spids:[26])] ) (AndOr children: [ (C {(git)} {(read-tree)} {(-n)} {(DQ ($ VSub_At "$@"))}) (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run)} spids: [51] ) ] ) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run)} {(post-dry-run)}) (C {(git)} {(read-tree)} {(DQ ($ VSub_At "$@"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [17] ) spids: [12 16] ) (FuncDef name: read_tree_must_fail body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre-dry-run)} spids:[91])] ) (AndOr children: [ (C {(test_must_fail)} {(git)} {(read-tree)} {(-n)} {(DQ ($ VSub_At "$@"))}) (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run)} spids: [118] ) ] ) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run)} {(post-dry-run)}) (C {(test_must_fail)} {(git)} {(read-tree)} {(DQ ($ VSub_At "$@"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [82] ) spids: [77 81] ) (FuncDef name: read_tree_u_must_succeed body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre-dry-run)} spids:[160])] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(diff-files)} {(-p)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(pre-dry-run-wt)} spids: [172] ) ] ) (AndOr children: [ (C {(git)} {(read-tree)} {(-n)} {(DQ ($ VSub_At "$@"))}) (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run)} spids: [197] ) ] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(diff-files)} {(-p)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run-wt)} spids: [209] ) ] ) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run)} {(post-dry-run)}) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run-wt)} {(post-dry-run-wt)}) (C {(git)} {(read-tree)} {(DQ ($ VSub_At "$@"))}) ] 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: [151] ) spids: [146 150] ) (FuncDef name: read_tree_u_must_fail body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre-dry-run)} spids:[258])] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(diff-files)} {(-p)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(pre-dry-run-wt)} spids: [270] ) ] ) (AndOr children: [ (C {(test_must_fail)} {(git)} {(read-tree)} {(-n)} {(DQ ($ VSub_At "$@"))}) (AndOr children: [ (SimpleCommand words: [{(git)} {(ls-files)} {(-s)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run)} spids: [297] ) ] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(diff-files)} {(-p)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(post-dry-run-wt)} spids: [309] ) ] ) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run)} {(post-dry-run)}) (AndOr children: [ (C {(test_cmp)} {(pre-dry-run-wt)} {(post-dry-run-wt)}) (C {(test_must_fail)} {(git)} {(read-tree)} {(DQ ($ VSub_At "$@"))} ) ] 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: [249] ) spids: [244 248] ) ] )