]>
Commit | Line | Data |
---|---|---|
b560707a SP |
1 | #!/bin/sh |
2 | ||
3 | test_description='Various filesystem issues' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
77e57265 JN |
7 | auml=$(printf '\303\244') |
8 | aumlcdiar=$(printf '\141\314\210') | |
b560707a | 9 | |
1c51c7d7 | 10 | case_insensitive= |
5b46a428 | 11 | unibad= |
64e61f2d JS |
12 | no_symlinks= |
13 | test_expect_success 'see what we expect' ' | |
b560707a | 14 | |
a48fcd83 JN |
15 | test_case=test_expect_success && |
16 | test_unicode=test_expect_success && | |
b560707a SP |
17 | mkdir junk && |
18 | echo good >junk/CamelCase && | |
19 | echo bad >junk/camelcase && | |
20 | if test "$(cat junk/CamelCase)" != good | |
21 | then | |
a48fcd83 | 22 | test_case=test_expect_failure && |
1c51c7d7 | 23 | case_insensitive=t |
b560707a SP |
24 | fi && |
25 | rm -fr junk && | |
26 | mkdir junk && | |
27 | >junk/"$auml" && | |
28 | case "$(cd junk && echo *)" in | |
29 | "$aumlcdiar") | |
a48fcd83 | 30 | test_unicode=test_expect_failure && |
5b46a428 | 31 | unibad=t |
b560707a SP |
32 | ;; |
33 | *) ;; | |
34 | esac && | |
64e61f2d JS |
35 | rm -fr junk && |
36 | { | |
37 | ln -s x y 2> /dev/null && | |
38 | test -h y 2> /dev/null || | |
a48fcd83 | 39 | no_symlinks=1 && |
64e61f2d JS |
40 | rm -f y |
41 | } | |
b560707a SP |
42 | ' |
43 | ||
5b46a428 JS |
44 | test "$case_insensitive" && |
45 | say "will test on a case insensitive filesystem" | |
46 | test "$unibad" && | |
47 | say "will test on a unicode corrupting filesystem" | |
64e61f2d JS |
48 | test "$no_symlinks" && |
49 | say "will test on a filesystem lacking symbolic links" | |
5b46a428 | 50 | |
1c51c7d7 SP |
51 | if test "$case_insensitive" |
52 | then | |
53 | test_expect_success "detection of case insensitive filesystem during repo init" ' | |
54 | ||
55 | test $(git config --bool core.ignorecase) = true | |
56 | ' | |
57 | else | |
58 | test_expect_success "detection of case insensitive filesystem during repo init" ' | |
59 | ||
d492b31c | 60 | test_must_fail git config --bool core.ignorecase >/dev/null || |
1c51c7d7 SP |
61 | test $(git config --bool core.ignorecase) = false |
62 | ' | |
63 | fi | |
64 | ||
64e61f2d JS |
65 | if test "$no_symlinks" |
66 | then | |
67 | test_expect_success "detection of filesystem w/o symlink support during repo init" ' | |
68 | ||
69 | v=$(git config --bool core.symlinks) && | |
70 | test "$v" = false | |
71 | ' | |
72 | else | |
73 | test_expect_success "detection of filesystem w/o symlink support during repo init" ' | |
74 | ||
75 | test_must_fail git config --bool core.symlinks || | |
76 | test "$(git config --bool core.symlinks)" = true | |
77 | ' | |
78 | fi | |
79 | ||
b560707a SP |
80 | test_expect_success "setup case tests" ' |
81 | ||
b4a299d8 | 82 | git config core.ignorecase true && |
b560707a SP |
83 | touch camelcase && |
84 | git add camelcase && | |
85 | git commit -m "initial" && | |
86 | git tag initial && | |
87 | git checkout -b topic && | |
88 | git mv camelcase tmp && | |
89 | git mv tmp CamelCase && | |
90 | git commit -m "rename" && | |
91 | git checkout -f master | |
92 | ||
93 | ' | |
94 | ||
95 | $test_case 'rename (case change)' ' | |
96 | ||
97 | git mv camelcase CamelCase && | |
98 | git commit -m "rename" | |
99 | ||
100 | ' | |
101 | ||
102 | $test_case 'merge (case change)' ' | |
103 | ||
0047dd2f SP |
104 | rm -f CamelCase && |
105 | rm -f camelcase && | |
b560707a SP |
106 | git reset --hard initial && |
107 | git merge topic | |
108 | ||
109 | ' | |
110 | ||
0d7c2430 JH |
111 | |
112 | ||
113 | test_expect_failure 'add (with different case)' ' | |
8a19aaab SP |
114 | |
115 | git reset --hard initial && | |
116 | rm camelcase && | |
117 | echo 1 >CamelCase && | |
118 | git add CamelCase && | |
0d7c2430 JH |
119 | camel=$(git ls-files | grep -i camelcase) && |
120 | test $(echo "$camel" | wc -l) = 1 && | |
121 | test "z$(git cat-file blob :$camel)" = z1 | |
8a19aaab SP |
122 | |
123 | ' | |
124 | ||
b560707a SP |
125 | test_expect_success "setup unicode normalization tests" ' |
126 | ||
127 | test_create_repo unicode && | |
128 | cd unicode && | |
129 | touch "$aumlcdiar" && | |
130 | git add "$aumlcdiar" && | |
a48fcd83 | 131 | git commit -m initial && |
b560707a SP |
132 | git tag initial && |
133 | git checkout -b topic && | |
134 | git mv $aumlcdiar tmp && | |
135 | git mv tmp "$auml" && | |
136 | git commit -m rename && | |
137 | git checkout -f master | |
138 | ||
139 | ' | |
140 | ||
141 | $test_unicode 'rename (silent unicode normalization)' ' | |
142 | ||
143 | git mv "$aumlcdiar" "$auml" && | |
144 | git commit -m rename | |
145 | ||
146 | ' | |
147 | ||
148 | $test_unicode 'merge (silent unicode normalization)' ' | |
149 | ||
150 | git reset --hard initial && | |
151 | git merge topic | |
152 | ||
153 | ' | |
154 | ||
155 | test_done |