3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='quoted output'
8 TEST_PASSES_SANITIZE_LEAK
=true
16 test_have_prereq MINGW ||
17 echo foo
2>/dev
/null
> "Name and an${HT}HT"
18 if ! test -f "Name and an${HT}HT"
20 # FAT/NTFS does not allow tabs in filenames
21 skip_all
='Your filesystem does not allow tabs in filenames'
27 Name
"Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
28 "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
29 "With SP in it" "$FN/file"
35 test_expect_success
'setup' '
38 for_each_name "echo initial >\"\$name\"" &&
40 git commit -q -m Initial &&
42 for_each_name "echo second >\"\$name\"" &&
43 git commit -a -m Second &&
45 for_each_name "echo modified >\"\$name\""
49 test_expect_success
'setup expected files' '
50 cat >expect.quoted <<\EOF &&
56 "\346\277\261\351\207\216\t\347\264\224"
57 "\346\277\261\351\207\216\n\347\264\224"
58 "\346\277\261\351\207\216 \347\264\224"
59 "\346\277\261\351\207\216\"\347\264\224"
60 "\346\277\261\351\207\216/file"
61 "\346\277\261\351\207\216\347\264\224"
64 cat >expect.raw <<\EOF
79 test_expect_success
'check fully quoted output from ls-files' '
81 git ls-files >current && test_cmp expect.quoted current
85 test_expect_success
'check fully quoted output from diff-files' '
87 git diff --name-only >current &&
88 test_cmp expect.quoted current
92 test_expect_success
'check fully quoted output from diff-index' '
94 git diff --name-only HEAD >current &&
95 test_cmp expect.quoted current
99 test_expect_success
'check fully quoted output from diff-tree' '
101 git diff --name-only HEAD^ HEAD >current &&
102 test_cmp expect.quoted current
106 test_expect_success
'check fully quoted output from ls-tree' '
108 git ls-tree --name-only -r HEAD >current &&
109 test_cmp expect.quoted current
113 test_expect_success
'setting core.quotepath' '
115 git config --bool core.quotepath false
119 test_expect_success
'check fully quoted output from ls-files' '
121 git ls-files >current && test_cmp expect.raw current
125 test_expect_success
'check fully quoted output from diff-files' '
127 git diff --name-only >current &&
128 test_cmp expect.raw current
132 test_expect_success
'check fully quoted output from diff-index' '
134 git diff --name-only HEAD >current &&
135 test_cmp expect.raw current
139 test_expect_success
'check fully quoted output from diff-tree' '
141 git diff --name-only HEAD^ HEAD >current &&
142 test_cmp expect.raw current
146 test_expect_success
'check fully quoted output from ls-tree' '
148 git ls-tree --name-only -r HEAD >current &&
149 test_cmp expect.raw current