3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='quoted output'
11 : >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" ||
{
12 echo >&2 'Filesystem does not support HT in names'
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" \
33 test_expect_success setup
'
35 for_each_name "echo initial >\"\$name\""
37 git commit -q -m Initial &&
39 for_each_name "echo second >\"\$name\"" &&
40 git commit -a -m Second
42 for_each_name "echo modified >\"\$name\""
46 cat >expect.quoted
<<\EOF
52 "\346\277\261\351\207\216\t\347\264\224"
53 "\346\277\261\351\207\216\n\347\264\224"
54 "\346\277\261\351\207\216 \347\264\224"
55 "\346\277\261\351\207\216\"\347\264\224"
56 "\346\277\261\351\207\216\347\264\224"
59 cat >expect.raw
<<\EOF
72 test_expect_success
'check fully quoted output from ls-files' '
74 git ls-files >current && diff -u expect.quoted current
78 test_expect_success
'check fully quoted output from diff-files' '
80 git diff --name-only >current &&
81 diff -u expect.quoted current
85 test_expect_success
'check fully quoted output from diff-index' '
87 git diff --name-only HEAD >current &&
88 diff -u expect.quoted current
92 test_expect_success
'check fully quoted output from diff-tree' '
94 git diff --name-only HEAD^ HEAD >current &&
95 diff -u expect.quoted current
99 test_expect_success
'setting core.quotepath' '
101 git config --bool core.quotepath false
105 test_expect_success
'check fully quoted output from ls-files' '
107 git ls-files >current && diff -u expect.raw current
111 test_expect_success
'check fully quoted output from diff-files' '
113 git diff --name-only >current &&
114 diff -u expect.raw current
118 test_expect_success
'check fully quoted output from diff-index' '
120 git diff --name-only HEAD >current &&
121 diff -u expect.raw current
125 test_expect_success
'check fully quoted output from diff-tree' '
127 git diff --name-only HEAD^ HEAD >current &&
128 diff -u expect.raw current