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