3 # Copyright (c) 2006 Junio C Hamano
6 test_description='quoted output'
17 echo foo 2>/dev/null > "Name and an${HT}HT"
18 test -f "Name and an${HT}HT" || {
19 # since FAT/NTFS does not allow tabs in filenames, skip this test
20 say 'Your filesystem does not allow tabs in filenames, test skipped.'
26 Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
27 "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
28 "With SP in it" "$FN/file"
34 test_expect_success setup '
37 for_each_name "echo initial >\"\$name\""
39 git commit -q -m Initial &&
41 for_each_name "echo second >\"\$name\"" &&
42 git commit -a -m Second
44 for_each_name "echo modified >\"\$name\""
48 cat >expect.quoted <<\EOF
54 "\346\277\261\351\207\216\t\347\264\224"
55 "\346\277\261\351\207\216\n\347\264\224"
56 "\346\277\261\351\207\216 \347\264\224"
57 "\346\277\261\351\207\216\"\347\264\224"
58 "\346\277\261\351\207\216/file"
59 "\346\277\261\351\207\216\347\264\224"
62 cat >expect.raw <<\EOF
76 test_expect_success 'check fully quoted output from ls-files' '
78 git ls-files >current && test_cmp expect.quoted current
82 test_expect_success 'check fully quoted output from diff-files' '
84 git diff --name-only >current &&
85 test_cmp expect.quoted current
89 test_expect_success 'check fully quoted output from diff-index' '
91 git diff --name-only HEAD >current &&
92 test_cmp expect.quoted current
96 test_expect_success 'check fully quoted output from diff-tree' '
98 git diff --name-only HEAD^ HEAD >current &&
99 test_cmp expect.quoted current
103 test_expect_success 'check fully quoted output from ls-tree' '
105 git ls-tree --name-only -r HEAD >current &&
106 test_cmp expect.quoted current
110 test_expect_success 'setting core.quotepath' '
112 git config --bool core.quotepath false
116 test_expect_success 'check fully quoted output from ls-files' '
118 git ls-files >current && test_cmp expect.raw current
122 test_expect_success 'check fully quoted output from diff-files' '
124 git diff --name-only >current &&
125 test_cmp expect.raw current
129 test_expect_success 'check fully quoted output from diff-index' '
131 git diff --name-only HEAD >current &&
132 test_cmp expect.raw current
136 test_expect_success 'check fully quoted output from diff-tree' '
138 git diff --name-only HEAD^ HEAD >current &&
139 test_cmp expect.raw current
143 test_expect_success 'check fully quoted output from ls-tree' '
145 git ls-tree --name-only -r HEAD >current &&
146 test_cmp expect.raw current