t0050: use the CASE_INSENSITIVE_FS test prereq
[git/mingw.git] / t / t0050-filesystem.sh
blobdf9498b7d0793fd116c69de2b83c89f767d80351
1 #!/bin/sh
3 test_description='Various filesystem issues'
5 . ./test-lib.sh
7 auml=$(printf '\303\244')
8 aumlcdiar=$(printf '\141\314\210')
10 unibad=
11 no_symlinks=
12 test_expect_success 'see what we expect' '
14 test_unicode=test_expect_success &&
15 mkdir junk &&
16 >junk/"$auml" &&
17 case "$(cd junk && echo *)" in
18 "$aumlcdiar")
19 test_unicode=test_expect_failure &&
20 unibad=t
22 *) ;;
23 esac &&
24 rm -fr junk &&
26 ln -s x y 2> /dev/null &&
27 test -h y 2> /dev/null ||
28 no_symlinks=1 &&
29 rm -f y
33 if test_have_prereq CASE_INSENSITIVE_FS
34 then
35 say "will test on a case insensitive filesystem"
36 test_case=test_expect_failure
37 else
38 test_case=test_expect_success
41 test "$unibad" &&
42 say "will test on a unicode corrupting filesystem"
43 test "$no_symlinks" &&
44 say "will test on a filesystem lacking symbolic links"
46 if test_have_prereq CASE_INSENSITIVE_FS
47 then
48 test_expect_success "detection of case insensitive filesystem during repo init" '
50 test $(git config --bool core.ignorecase) = true
52 else
53 test_expect_success "detection of case insensitive filesystem during repo init" '
55 test_must_fail git config --bool core.ignorecase >/dev/null ||
56 test $(git config --bool core.ignorecase) = false
60 if test "$no_symlinks"
61 then
62 test_expect_success "detection of filesystem w/o symlink support during repo init" '
64 v=$(git config --bool core.symlinks) &&
65 test "$v" = false
67 else
68 test_expect_success "detection of filesystem w/o symlink support during repo init" '
70 test_must_fail git config --bool core.symlinks ||
71 test "$(git config --bool core.symlinks)" = true
75 test_expect_success "setup case tests" '
77 git config core.ignorecase true &&
78 touch camelcase &&
79 git add camelcase &&
80 git commit -m "initial" &&
81 git tag initial &&
82 git checkout -b topic &&
83 git mv camelcase tmp &&
84 git mv tmp CamelCase &&
85 git commit -m "rename" &&
86 git checkout -f master
90 $test_case 'rename (case change)' '
92 git mv camelcase CamelCase &&
93 git commit -m "rename"
97 $test_case 'merge (case change)' '
99 rm -f CamelCase &&
100 rm -f camelcase &&
101 git reset --hard initial &&
102 git merge topic
108 test_expect_failure 'add (with different case)' '
110 git reset --hard initial &&
111 rm camelcase &&
112 echo 1 >CamelCase &&
113 git add CamelCase &&
114 camel=$(git ls-files | grep -i camelcase) &&
115 test $(echo "$camel" | wc -l) = 1 &&
116 test "z$(git cat-file blob :$camel)" = z1
120 test_expect_success "setup unicode normalization tests" '
122 test_create_repo unicode &&
123 cd unicode &&
124 touch "$aumlcdiar" &&
125 git add "$aumlcdiar" &&
126 git commit -m initial &&
127 git tag initial &&
128 git checkout -b topic &&
129 git mv $aumlcdiar tmp &&
130 git mv tmp "$auml" &&
131 git commit -m rename &&
132 git checkout -f master
136 $test_unicode 'rename (silent unicode normalization)' '
138 git mv "$aumlcdiar" "$auml" &&
139 git commit -m rename
143 $test_unicode 'merge (silent unicode normalization)' '
145 git reset --hard initial &&
146 git merge topic
150 test_done