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 skip_all='Your filesystem does not allow tabs in filenames'
25 Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
26 "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
27 "With SP in it" "$FN/file"
33 test_expect_success 'setup' '
36 for_each_name "echo initial >\"\$name\"" &&
38 git commit -q -m Initial &&
40 for_each_name "echo second >\"\$name\"" &&
41 git commit -a -m Second &&
43 for_each_name "echo modified >\"\$name\""
47 test_expect_success 'setup expected files' '
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
77 test_expect_success 'check fully quoted output from ls-files' '
79 git ls-files >current && test_cmp expect.quoted current
83 test_expect_success 'check fully quoted output from diff-files' '
85 git diff --name-only >current &&
86 test_cmp expect.quoted current
90 test_expect_success 'check fully quoted output from diff-index' '
92 git diff --name-only HEAD >current &&
93 test_cmp expect.quoted current
97 test_expect_success 'check fully quoted output from diff-tree' '
99 git diff --name-only HEAD^ HEAD >current &&
100 test_cmp expect.quoted current
104 test_expect_success 'check fully quoted output from ls-tree' '
106 git ls-tree --name-only -r HEAD >current &&
107 test_cmp expect.quoted current
111 test_expect_success 'setting core.quotepath' '
113 git config --bool core.quotepath false
117 test_expect_success 'check fully quoted output from ls-files' '
119 git ls-files >current && test_cmp expect.raw current
123 test_expect_success 'check fully quoted output from diff-files' '
125 git diff --name-only >current &&
126 test_cmp expect.raw current
130 test_expect_success 'check fully quoted output from diff-index' '
132 git diff --name-only HEAD >current &&
133 test_cmp expect.raw current
137 test_expect_success 'check fully quoted output from diff-tree' '
139 git diff --name-only HEAD^ HEAD >current &&
140 test_cmp expect.raw current
144 test_expect_success 'check fully quoted output from ls-tree' '
146 git ls-tree --name-only -r HEAD >current &&
147 test_cmp expect.raw current