(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ <'Pathnames with funny characters.\n'> <'\n'> <'This test tries pathnames with funny characters in the working\n'> <'tree, index, and tree objects.\n'> ) } spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HT) op: assign_op.Equal rhs: {(SQ <'\t'>)} spids: [27] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<test_have_prereq>} {<MINGW>}) (command.Simple words: [{<echo>}] redirects: [ (redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>}) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ <'Name with an'> (${ Id.VSub_Name HT) <HT>)} ) ] do_fork: T ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Pipeline children: [(C {<test>} {<-f>} {(DQ <'Name with an'> (${ Id.VSub_Name HT) <HT>)})] negated: T ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:skip_all) op: assign_op.Equal rhs: {(SQ <'Your filesystem does not allow tabs in filenames'>)} spids: [77] ) ] ) (C {<test_done>}) ] spids: [54 70] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:p0) op: assign_op.Equal rhs: {(SQ <no-funny>)} spids: [88] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:p1) op: assign_op.Equal rhs: {(SQ <'tabs\t," (dq) and spaces'>)} spids: [93] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:p2) op: assign_op.Equal rhs: {(SQ <'just space'>)} spids: [98] ) ] ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tcat >"$p0" <<-\\EOF &&\n'> <'\t1. A quick brown fox jumps over the lazy cat, oops dog.\n'> <'\t2. A quick brown fox jumps over the lazy cat, oops dog.\n'> <'\t3. A quick brown fox jumps over the lazy cat, oops dog.\n'> <'\tEOF\n'> <'\n'> <'\t{ cat "$p0" >"$p1" || :; } &&\n'> <'\t{ echo "Foo Bar Baz" >"$p2" || :; }\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: populate index and tree'>)} {(SQ <'\n'> <'\tgit update-index --add "$p0" "$p2" &&\n'> <'\tt0=$(git write-tree)\n'>)} ) (C {<test_expect_success>} {(SQ <'ls-files prints space in filename verbatim'>)} { (SQ <'\n'> <'\tprintf "%s\\n" "just space" no-funny >expected &&\n'> <'\tgit ls-files >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: add funny filename'>)} {(SQ <'\n'> <'\tgit update-index --add "$p1" &&\n'> <'\tt1=$(git write-tree)\n'>)} ) (C {<test_expect_success>} {(SQ <'ls-files quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tjust space\n'> <'\tno-funny\n'> <'\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit ls-files >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'ls-files -z does not quote funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tjust space\n'> <'\tno-funny\n'> <'\ttabs\t," (dq) and spaces\n'> <'\tEOF\n'> <'\tgit ls-files -z >ls-files.z &&\n'> <'\tperl -pe "y/\\000/\\012/" <ls-files.z >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'ls-tree quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tjust space\n'> <'\tno-funny\n'> <'\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit ls-tree -r $t1 >ls-tree &&\n'> <'\tsed -e "s/^[^\t]*\t//" <ls-tree >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-index --name-status quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tA\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index --name-status $t0 >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-tree --name-status quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tA\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-tree --name-status $t0 $t1 >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-index -z does not quote funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tA\n'> <'\ttabs\t," (dq) and spaces\n'> <'\tEOF\n'> <'\tgit diff-index -z --name-status $t0 >diff-index.z &&\n'> <'\tperl -pe "y/\\000/\\012/" <diff-index.z >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-tree -z does not quote funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tA\n'> <'\ttabs\t," (dq) and spaces\n'> <'\tEOF\n'> <'\tgit diff-tree -z --name-status $t0 $t1 >diff-tree.z &&\n'> <'\tperl -pe y/\\\\000/\\\\012/ <diff-tree.z >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-tree --find-copies-harder quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tCNUM\tno-funny\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-tree -C --find-copies-harder --name-status $t0 $t1 >out &&\n'> <'\tsed -e "s/^C[0-9]*/CNUM/" <out >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: remove unfunny index entry'>)} {(SQ <'\n'> <'\tgit update-index --force-remove "$p0"\n'>)} ) (C {<test_expect_success>} {(SQ <'diff-tree -M quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tRNUM\tno-funny\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -M --name-status $t0 >out &&\n'> <'\tsed -e "s/^R[0-9]*/RNUM/" <out >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff-index -M -p quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tdiff --git a/no-funny "b/tabs\\t,\\" (dq) and spaces"\n'> <'\tsimilarity index NUM%\n'> <'\trename from no-funny\n'> <'\trename to "tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -M -p $t0 >diff &&\n'> <'\tsed -e "s/index [0-9]*%/index NUM%/" <diff >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: mode change'>)} {(SQ <'\n'> <'\tchmod +x "$p1"\n'>)}) (C {<test_expect_success>} {(SQ <'diff-index -M -p with mode change quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tdiff --git a/no-funny "b/tabs\\t,\\" (dq) and spaces"\n'> <'\told mode 100644\n'> <'\tnew mode 100755\n'> <'\tsimilarity index NUM%\n'> <'\trename from no-funny\n'> <'\trename to "tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -M -p $t0 >diff &&\n'> <'\tsed -e "s/index [0-9]*%/index NUM%/" <diff >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diffstat for rename quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t "tabs\\t,\\" (dq) and spaces"\n'> <'\t 1 file changed, 0 insertions(+), 0 deletions(-)\n'> <'\tEOF\n'> <'\tgit diff-index -M -p $t0 >diff &&\n'> <'\tgit apply --stat <diff >diffstat &&\n'> <'\tsed -e "s/|.*//" -e "s/ *\\$//" <diffstat >current &&\n'> <'\ttest_i18ncmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'numstat for rename quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t0\t0\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -M -p $t0 >diff &&\n'> <'\tgit apply --numstat <diff >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'numstat without -M quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t0\t3\tno-funny\n'> <'\t3\t0\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -p $t0 >diff &&\n'> <'\tgit apply --numstat <diff >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'numstat for non-git rename diff quotes funny filename'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t0\t3\tno-funny\n'> <'\t3\t0\t"tabs\\t,\\" (dq) and spaces"\n'> <'\tEOF\n'> <'\tgit diff-index -p $t0 >git-diff &&\n'> <'\tsed -ne "/^[-+@]/p" <git-diff >diff &&\n'> <'\tgit apply --numstat <diff >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {<test_done>}) ] )