3 # Copyright (c) 2006 Junio C Hamano
6 test_description='quoted output'
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 say 'Your filesystem does not allow tabs in filenames'
23 test_set_prereq TABS_IN_FILENAMES
28 Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
29 "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
30 "With SP in it" "$FN/file"
36 test_expect_success TABS_IN_FILENAMES 'setup' '
39 for_each_name "echo initial >\"\$name\""
41 git commit -q -m Initial &&
43 for_each_name "echo second >\"\$name\"" &&
44 git commit -a -m Second
46 for_each_name "echo modified >\"\$name\""
50 test_expect_success TABS_IN_FILENAMES 'setup expected files' '
51 cat >expect.quoted <<\EOF
57 "\346\277\261\351\207\216\t\347\264\224"
58 "\346\277\261\351\207\216\n\347\264\224"
59 "\346\277\261\351\207\216 \347\264\224"
60 "\346\277\261\351\207\216\"\347\264\224"
61 "\346\277\261\351\207\216/file"
62 "\346\277\261\351\207\216\347\264\224"
65 cat >expect.raw <<\EOF
80 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
82 git ls-files >current && test_cmp expect.quoted current
86 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
88 git diff --name-only >current &&
89 test_cmp expect.quoted current
93 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
95 git diff --name-only HEAD >current &&
96 test_cmp expect.quoted current
100 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
102 git diff --name-only HEAD^ HEAD >current &&
103 test_cmp expect.quoted current
107 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
109 git ls-tree --name-only -r HEAD >current &&
110 test_cmp expect.quoted current
114 test_expect_success TABS_IN_FILENAMES 'setting core.quotepath' '
116 git config --bool core.quotepath false
120 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
122 git ls-files >current && test_cmp expect.raw current
126 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
128 git diff --name-only >current &&
129 test_cmp expect.raw current
133 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
135 git diff --name-only HEAD >current &&
136 test_cmp expect.raw current
140 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
142 git diff --name-only HEAD^ HEAD >current &&
143 test_cmp expect.raw current
147 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
149 git ls-tree --name-only -r HEAD >current &&
150 test_cmp expect.raw current