t0050: Use TAB for indentation
[git/jnareb-git.git] / t / t3902-quoted.sh
blob534ee08a44b9d8501b234f228302e9a266d67f8c
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 DQ='"'
15 echo foo 2>/dev/null > "Name and an${HT}HT"
16 if ! test -f "Name and an${HT}HT"
17 then
18 # FAT/NTFS does not allow tabs in filenames
19 say 'Your filesystem does not allow tabs in filenames'
20 else
21 test_set_prereq TABS_IN_FILENAMES
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 TABS_IN_FILENAMES '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 test_expect_success TABS_IN_FILENAMES 'setup expected files' '
49 cat >expect.quoted <<\EOF &&
50 Name
51 "Name and a\nLF"
52 "Name and an\tHT"
53 "Name\""
54 With SP in it
55 "\346\277\261\351\207\216\t\347\264\224"
56 "\346\277\261\351\207\216\n\347\264\224"
57 "\346\277\261\351\207\216 \347\264\224"
58 "\346\277\261\351\207\216\"\347\264\224"
59 "\346\277\261\351\207\216/file"
60 "\346\277\261\351\207\216\347\264\224"
61 EOF
63 cat >expect.raw <<\EOF
64 Name
65 "Name and a\nLF"
66 "Name and an\tHT"
67 "Name\""
68 With SP in it
69 "濱野\t純"
70 "濱野\n純"
71 濱野 純
72 "濱野\"純"
73 濱野/file
74 濱野純
75 EOF
78 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
80 git ls-files >current && test_cmp expect.quoted current
84 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
86 git diff --name-only >current &&
87 test_cmp expect.quoted current
91 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
93 git diff --name-only HEAD >current &&
94 test_cmp expect.quoted current
98 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
100 git diff --name-only HEAD^ HEAD >current &&
101 test_cmp expect.quoted current
105 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
107 git ls-tree --name-only -r HEAD >current &&
108 test_cmp expect.quoted current
112 test_expect_success TABS_IN_FILENAMES 'setting core.quotepath' '
114 git config --bool core.quotepath false
118 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-files' '
120 git ls-files >current && test_cmp expect.raw current
124 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-files' '
126 git diff --name-only >current &&
127 test_cmp expect.raw current
131 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-index' '
133 git diff --name-only HEAD >current &&
134 test_cmp expect.raw current
138 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from diff-tree' '
140 git diff --name-only HEAD^ HEAD >current &&
141 test_cmp expect.raw current
145 test_expect_success TABS_IN_FILENAMES 'check fully quoted output from ls-tree' '
147 git ls-tree --name-only -r HEAD >current &&
148 test_cmp expect.raw current
152 test_done