git am: ignore dirty submodules
[git/mingw/4msysgit/kblees.git] / t / t3902-quoted.sh
blob29103f65dc60a81d071b9dd5600f416b3a31860f
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='quoted output'
8 . ./test-lib.sh
10 FN='濱野'
11 GN='純'
12 HT=' '
13 LF='
15 DQ='"'
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.'
21 test_done
24 for_each_name () {
25 for name in \
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"
30 eval "$1"
31 done
34 test_expect_success setup '
36 mkdir "$FN" &&
37 for_each_name "echo initial >\"\$name\""
38 git add . &&
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 cat >expect.quoted <<\EOF
49 Name
50 "Name and a\nLF"
51 "Name and an\tHT"
52 "Name\""
53 With SP in it
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"
60 EOF
62 cat >expect.raw <<\EOF
63 Name
64 "Name and a\nLF"
65 "Name and an\tHT"
66 "Name\""
67 With SP in it
68 "濱野\t純"
69 "濱野\n純"
70 濱野 純
71 "濱野\"純"
72 濱野/file
73 濱野純
74 EOF
76 test_expect_success 'check fully quoted output from ls-files' '
78 git ls-files >current && test_cmp expect.quoted current
82 test_expect_success 'check fully quoted output from diff-files' '
84 git diff --name-only >current &&
85 test_cmp expect.quoted current
89 test_expect_success 'check fully quoted output from diff-index' '
91 git diff --name-only HEAD >current &&
92 test_cmp expect.quoted current
96 test_expect_success 'check fully quoted output from diff-tree' '
98 git diff --name-only HEAD^ HEAD >current &&
99 test_cmp expect.quoted current
103 test_expect_success 'check fully quoted output from ls-tree' '
105 git ls-tree --name-only -r HEAD >current &&
106 test_cmp expect.quoted current
110 test_expect_success 'setting core.quotepath' '
112 git config --bool core.quotepath false
116 test_expect_success 'check fully quoted output from ls-files' '
118 git ls-files >current && test_cmp expect.raw current
122 test_expect_success 'check fully quoted output from diff-files' '
124 git diff --name-only >current &&
125 test_cmp expect.raw current
129 test_expect_success 'check fully quoted output from diff-index' '
131 git diff --name-only HEAD >current &&
132 test_cmp expect.raw current
136 test_expect_success 'check fully quoted output from diff-tree' '
138 git diff --name-only HEAD^ HEAD >current &&
139 test_cmp expect.raw current
143 test_expect_success 'check fully quoted output from ls-tree' '
145 git ls-tree --name-only -r HEAD >current &&
146 test_cmp expect.raw current
150 test_done