3 # Copyright (c) 2006 Junio C Hamano
6 test_description='quoted output'
15 echo foo 2>/dev/null > "Name and an${HT}HT"
16 if ! test -f "Name and an${HT}HT"
18 # FAT/NTFS does not allow tabs in filenames
19 say 'Your filesystem does not allow tabs in filenames'
21 test_set_prereq TABS_IN_FILENAMES
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 TABS_IN_FILENAMES '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 test_expect_success TABS_IN_FILENAMES 'setup expected files' '
49 cat >expect.quoted <<\EOF &&
55 "\346\277\261\351\207\216\t\347\264\224"
56 "\346\277\261\351\207\216\n\347\264\224"
57 "\346\277\261\351\207\216 \347\264\224"
58 "\346\277\261\351\207\216\"\347\264\224"
59 "\346\277\261\351\207\216/file"
60 "\346\277\261\351\207\216\347\264\224"
63 cat >expect.raw <<\EOF
78 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
80 git ls-files >current && test_cmp expect.quoted current
84 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
86 git diff --name-only >current &&
87 test_cmp expect.quoted current
91 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
93 git diff --name-only HEAD >current &&
94 test_cmp expect.quoted current
98 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
100 git diff --name-only HEAD^ HEAD >current &&
101 test_cmp expect.quoted current
105 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
107 git ls-tree --name-only -r HEAD >current &&
108 test_cmp expect.quoted current
112 test_expect_success TABS_IN_FILENAMES 'setting core.quotepath' '
114 git config --bool core.quotepath false
118 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
120 git ls-files >current && test_cmp expect.raw current
124 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
126 git diff --name-only >current &&
127 test_cmp expect.raw current
131 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
133 git diff --name-only HEAD >current &&
134 test_cmp expect.raw current
138 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
140 git diff --name-only HEAD^ HEAD >current &&
141 test_cmp expect.raw current
145 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
147 git ls-tree --name-only -r HEAD >current &&
148 test_cmp expect.raw current