]>
Commit | Line | Data |
---|---|---|
9378c161 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='quoted output' | |
7 | ||
8 | . ./test-lib.sh | |
9 | ||
10 | FN='濱野' | |
11 | GN='純' | |
12 | HT=' ' | |
9378c161 JH |
13 | DQ='"' |
14 | ||
4539a898 | 15 | test_have_prereq MINGW || |
2b843732 | 16 | echo foo 2>/dev/null > "Name and an${HT}HT" |
a0beb132 ÆAB |
17 | if ! test -f "Name and an${HT}HT" |
18 | then | |
19 | # FAT/NTFS does not allow tabs in filenames | |
bb8eb64e RJ |
20 | skip_all='Your filesystem does not allow tabs in filenames' |
21 | test_done | |
a0beb132 | 22 | fi |
25482a3c | 23 | |
9378c161 JH |
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" \ | |
8b2337a5 | 28 | "With SP in it" "$FN/file" |
9378c161 JH |
29 | do |
30 | eval "$1" | |
31 | done | |
32 | } | |
33 | ||
bb8eb64e | 34 | test_expect_success 'setup' ' |
9378c161 | 35 | |
8b2337a5 | 36 | mkdir "$FN" && |
a48fcd83 | 37 | for_each_name "echo initial >\"\$name\"" && |
9378c161 JH |
38 | git add . && |
39 | git commit -q -m Initial && | |
40 | ||
41 | for_each_name "echo second >\"\$name\"" && | |
a48fcd83 | 42 | git commit -a -m Second && |
9378c161 JH |
43 | |
44 | for_each_name "echo modified >\"\$name\"" | |
45 | ||
46 | ' | |
47 | ||
bb8eb64e | 48 | test_expect_success 'setup expected files' ' |
a48fcd83 | 49 | cat >expect.quoted <<\EOF && |
9378c161 JH |
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" | |
8b2337a5 | 59 | "\346\277\261\351\207\216/file" |
9378c161 JH |
60 | "\346\277\261\351\207\216\347\264\224" |
61 | EOF | |
62 | ||
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 | "濱野\"純" | |
8b2337a5 | 73 | 濱野/file |
9378c161 JH |
74 | 濱野純 |
75 | EOF | |
a0beb132 | 76 | ' |
9378c161 | 77 | |
bb8eb64e | 78 | test_expect_success 'check fully quoted output from ls-files' ' |
9378c161 | 79 | |
82ebb0b6 | 80 | git ls-files >current && test_cmp expect.quoted current |
9378c161 JH |
81 | |
82 | ' | |
83 | ||
bb8eb64e | 84 | test_expect_success 'check fully quoted output from diff-files' ' |
9378c161 JH |
85 | |
86 | git diff --name-only >current && | |
82ebb0b6 | 87 | test_cmp expect.quoted current |
9378c161 JH |
88 | |
89 | ' | |
90 | ||
bb8eb64e | 91 | test_expect_success 'check fully quoted output from diff-index' ' |
9378c161 JH |
92 | |
93 | git diff --name-only HEAD >current && | |
82ebb0b6 | 94 | test_cmp expect.quoted current |
9378c161 JH |
95 | |
96 | ' | |
97 | ||
bb8eb64e | 98 | test_expect_success 'check fully quoted output from diff-tree' ' |
9378c161 JH |
99 | |
100 | git diff --name-only HEAD^ HEAD >current && | |
82ebb0b6 | 101 | test_cmp expect.quoted current |
9378c161 JH |
102 | |
103 | ' | |
104 | ||
bb8eb64e | 105 | test_expect_success 'check fully quoted output from ls-tree' ' |
84249819 JK |
106 | |
107 | git ls-tree --name-only -r HEAD >current && | |
108 | test_cmp expect.quoted current | |
109 | ||
110 | ' | |
111 | ||
bb8eb64e | 112 | test_expect_success 'setting core.quotepath' ' |
9378c161 JH |
113 | |
114 | git config --bool core.quotepath false | |
115 | ||
116 | ' | |
117 | ||
bb8eb64e | 118 | test_expect_success 'check fully quoted output from ls-files' ' |
9378c161 | 119 | |
82ebb0b6 | 120 | git ls-files >current && test_cmp expect.raw current |
9378c161 JH |
121 | |
122 | ' | |
123 | ||
bb8eb64e | 124 | test_expect_success 'check fully quoted output from diff-files' ' |
9378c161 JH |
125 | |
126 | git diff --name-only >current && | |
82ebb0b6 | 127 | test_cmp expect.raw current |
9378c161 JH |
128 | |
129 | ' | |
130 | ||
bb8eb64e | 131 | test_expect_success 'check fully quoted output from diff-index' ' |
9378c161 JH |
132 | |
133 | git diff --name-only HEAD >current && | |
82ebb0b6 | 134 | test_cmp expect.raw current |
9378c161 JH |
135 | |
136 | ' | |
137 | ||
bb8eb64e | 138 | test_expect_success 'check fully quoted output from diff-tree' ' |
9378c161 JH |
139 | |
140 | git diff --name-only HEAD^ HEAD >current && | |
82ebb0b6 | 141 | test_cmp expect.raw current |
9378c161 JH |
142 | |
143 | ' | |
144 | ||
bb8eb64e | 145 | test_expect_success 'check fully quoted output from ls-tree' ' |
84249819 JK |
146 | |
147 | git ls-tree --name-only -r HEAD >current && | |
148 | test_cmp expect.raw current | |
149 | ||
150 | ' | |
151 | ||
9378c161 | 152 | test_done |