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" \
34 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 cat >expect.quoted
<<\EOF
53 "\346\277\261\351\207\216\t\347\264\224"
54 "\346\277\261\351\207\216\n\347\264\224"
55 "\346\277\261\351\207\216 \347\264\224"
56 "\346\277\261\351\207\216\"\347\264\224"
57 "\346\277\261\351\207\216\347\264\224"
60 cat >expect.raw
<<\EOF
73 test_expect_success
'check fully quoted output from ls-files' '
75 git ls-files >current && test_cmp expect.quoted current
79 test_expect_success
'check fully quoted output from diff-files' '
81 git diff --name-only >current &&
82 test_cmp expect.quoted current
86 test_expect_success
'check fully quoted output from diff-index' '
88 git diff --name-only HEAD >current &&
89 test_cmp expect.quoted current
93 test_expect_success
'check fully quoted output from diff-tree' '
95 git diff --name-only HEAD^ HEAD >current &&
96 test_cmp expect.quoted current
100 test_expect_success
'setting core.quotepath' '
102 git config --bool core.quotepath false
106 test_expect_success
'check fully quoted output from ls-files' '
108 git ls-files >current && test_cmp expect.raw current
112 test_expect_success
'check fully quoted output from diff-files' '
114 git diff --name-only >current &&
115 test_cmp expect.raw current
119 test_expect_success
'check fully quoted output from diff-index' '
121 git diff --name-only HEAD >current &&
122 test_cmp expect.raw current
126 test_expect_success
'check fully quoted output from diff-tree' '
128 git diff --name-only HEAD^ HEAD >current &&
129 test_cmp expect.raw current