t0050: use the SYMLINKS test prereq
[git.git] / t / t0050-filesystem.sh
blobb46ae72eac504619156caf1decc5d7d297492e0b
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 test_expect_success 'see what we expect' '
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
21 *) ;;
22 esac &&
23 rm -fr junk
26 if test_have_prereq CASE_INSENSITIVE_FS
27 then
28 say "will test on a case insensitive filesystem"
29 test_case=test_expect_failure
30 else
31 test_case=test_expect_success
34 test "$unibad" &&
35 say "will test on a unicode corrupting filesystem"
36 test_have_prereq SYMLINKS ||
37 say "will test on a filesystem lacking symbolic links"
39 if test_have_prereq CASE_INSENSITIVE_FS
40 then
41 test_expect_success "detection of case insensitive filesystem during repo init" '
43 test $(git config --bool core.ignorecase) = true
45 else
46 test_expect_success "detection of case insensitive filesystem during repo init" '
48 test_must_fail git config --bool core.ignorecase >/dev/null ||
49 test $(git config --bool core.ignorecase) = false
53 if test_have_prereq SYMLINKS
54 then
55 test_expect_success "detection of filesystem w/o symlink support during repo init" '
57 test_must_fail git config --bool core.symlinks ||
58 test "$(git config --bool core.symlinks)" = true
60 else
61 test_expect_success "detection of filesystem w/o symlink support during repo init" '
63 v=$(git config --bool core.symlinks) &&
64 test "$v" = false
68 test_expect_success "setup case tests" '
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
83 $test_case 'rename (case change)' '
85 git mv camelcase CamelCase &&
86 git commit -m "rename"
90 $test_case 'merge (case change)' '
92 rm -f CamelCase &&
93 rm -f camelcase &&
94 git reset --hard initial &&
95 git merge topic
101 test_expect_failure 'add (with different case)' '
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
113 test_expect_success "setup unicode normalization tests" '
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
129 $test_unicode 'rename (silent unicode normalization)' '
131 git mv "$aumlcdiar" "$auml" &&
132 git commit -m rename
136 $test_unicode 'merge (silent unicode normalization)' '
138 git reset --hard initial &&
139 git merge topic
143 test_done