]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
Call 'say' outside test_expect_success
[thirdparty/git.git] / t / t0050-filesystem.sh
CommitLineData
b560707a
SP
1#!/bin/sh
2
3test_description='Various filesystem issues'
4
5. ./test-lib.sh
6
e8e29c7b
JK
7auml=`printf '\xc3\xa4'`
8aumlcdiar=`printf '\x61\xcc\x88'`
b560707a 9
1c51c7d7 10case_insensitive=
5b46a428 11unibad=
b560707a
SP
12test_expect_success 'see if we expect ' '
13
14 test_case=test_expect_success
15 test_unicode=test_expect_success
16 mkdir junk &&
17 echo good >junk/CamelCase &&
18 echo bad >junk/camelcase &&
19 if test "$(cat junk/CamelCase)" != good
20 then
21 test_case=test_expect_failure
1c51c7d7 22 case_insensitive=t
b560707a
SP
23 fi &&
24 rm -fr junk &&
25 mkdir junk &&
26 >junk/"$auml" &&
27 case "$(cd junk && echo *)" in
28 "$aumlcdiar")
29 test_unicode=test_expect_failure
5b46a428 30 unibad=t
b560707a
SP
31 ;;
32 *) ;;
33 esac &&
34 rm -fr junk
35'
36
5b46a428
JS
37test "$case_insensitive" &&
38 say "will test on a case insensitive filesystem"
39test "$unibad" &&
40 say "will test on a unicode corrupting filesystem"
41
1c51c7d7
SP
42if test "$case_insensitive"
43then
44test_expect_success "detection of case insensitive filesystem during repo init" '
45
46 test $(git config --bool core.ignorecase) = true
47'
48else
49test_expect_success "detection of case insensitive filesystem during repo init" '
50
d492b31c 51 test_must_fail git config --bool core.ignorecase >/dev/null ||
1c51c7d7
SP
52 test $(git config --bool core.ignorecase) = false
53'
54fi
55
b560707a
SP
56test_expect_success "setup case tests" '
57
b4a299d8 58 git config core.ignorecase true &&
b560707a
SP
59 touch camelcase &&
60 git add camelcase &&
61 git commit -m "initial" &&
62 git tag initial &&
63 git checkout -b topic &&
64 git mv camelcase tmp &&
65 git mv tmp CamelCase &&
66 git commit -m "rename" &&
67 git checkout -f master
68
69'
70
71$test_case 'rename (case change)' '
72
73 git mv camelcase CamelCase &&
74 git commit -m "rename"
75
76'
77
78$test_case 'merge (case change)' '
79
0047dd2f
SP
80 rm -f CamelCase &&
81 rm -f camelcase &&
b560707a
SP
82 git reset --hard initial &&
83 git merge topic
84
85'
86
8a19aaab
SP
87$test_case 'add (with different case)' '
88
89 git reset --hard initial &&
90 rm camelcase &&
91 echo 1 >CamelCase &&
92 git add CamelCase &&
0cb0e143 93 test $(git ls-files | grep -i camelcase | wc -l) = 1
8a19aaab
SP
94
95'
96
b560707a
SP
97test_expect_success "setup unicode normalization tests" '
98
99 test_create_repo unicode &&
100 cd unicode &&
101 touch "$aumlcdiar" &&
102 git add "$aumlcdiar" &&
103 git commit -m initial
104 git tag initial &&
105 git checkout -b topic &&
106 git mv $aumlcdiar tmp &&
107 git mv tmp "$auml" &&
108 git commit -m rename &&
109 git checkout -f master
110
111'
112
113$test_unicode 'rename (silent unicode normalization)' '
114
115 git mv "$aumlcdiar" "$auml" &&
116 git commit -m rename
117
118'
119
120$test_unicode 'merge (silent unicode normalization)' '
121
122 git reset --hard initial &&
123 git merge topic
124
125'
126
127test_done