]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
Teach "git submodule add" the --name option
[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
77e57265
JN
7auml=$(printf '\303\244')
8aumlcdiar=$(printf '\141\314\210')
b560707a 9
9a3658b9
MG
10if test_have_prereq CASE_INSENSITIVE_FS
11then
5b46a428 12 say "will test on a case insensitive filesystem"
9a3658b9
MG
13 test_case=test_expect_failure
14else
15 test_case=test_expect_success
16fi
17
5b0b5dd4
MG
18if test_have_prereq UTF8_NFD_TO_NFC
19then
5b46a428 20 say "will test on a unicode corrupting filesystem"
5b0b5dd4
MG
21 test_unicode=test_expect_failure
22else
23 test_unicode=test_expect_success
24fi
25
2b71b522 26test_have_prereq SYMLINKS ||
64e61f2d 27 say "will test on a filesystem lacking symbolic links"
5b46a428 28
9a3658b9 29if test_have_prereq CASE_INSENSITIVE_FS
1c51c7d7
SP
30then
31test_expect_success "detection of case insensitive filesystem during repo init" '
32
33 test $(git config --bool core.ignorecase) = true
34'
35else
36test_expect_success "detection of case insensitive filesystem during repo init" '
37
d492b31c 38 test_must_fail git config --bool core.ignorecase >/dev/null ||
1c51c7d7
SP
39 test $(git config --bool core.ignorecase) = false
40'
41fi
42
2b71b522 43if test_have_prereq SYMLINKS
64e61f2d
JS
44then
45test_expect_success "detection of filesystem w/o symlink support during repo init" '
46
2b71b522
MG
47 test_must_fail git config --bool core.symlinks ||
48 test "$(git config --bool core.symlinks)" = true
64e61f2d
JS
49'
50else
51test_expect_success "detection of filesystem w/o symlink support during repo init" '
52
2b71b522
MG
53 v=$(git config --bool core.symlinks) &&
54 test "$v" = false
64e61f2d
JS
55'
56fi
57
b560707a
SP
58test_expect_success "setup case tests" '
59
b4a299d8 60 git config core.ignorecase true &&
b560707a
SP
61 touch camelcase &&
62 git add camelcase &&
63 git commit -m "initial" &&
64 git tag initial &&
65 git checkout -b topic &&
66 git mv camelcase tmp &&
67 git mv tmp CamelCase &&
68 git commit -m "rename" &&
69 git checkout -f master
70
71'
72
73$test_case 'rename (case change)' '
74
75 git mv camelcase CamelCase &&
76 git commit -m "rename"
77
78'
79
80$test_case 'merge (case change)' '
81
0047dd2f
SP
82 rm -f CamelCase &&
83 rm -f camelcase &&
b560707a
SP
84 git reset --hard initial &&
85 git merge topic
86
87'
88
0d7c2430
JH
89
90
91test_expect_failure 'add (with different case)' '
8a19aaab
SP
92
93 git reset --hard initial &&
94 rm camelcase &&
95 echo 1 >CamelCase &&
96 git add CamelCase &&
0d7c2430
JH
97 camel=$(git ls-files | grep -i camelcase) &&
98 test $(echo "$camel" | wc -l) = 1 &&
99 test "z$(git cat-file blob :$camel)" = z1
8a19aaab
SP
100
101'
102
b560707a
SP
103test_expect_success "setup unicode normalization tests" '
104
105 test_create_repo unicode &&
106 cd unicode &&
107 touch "$aumlcdiar" &&
108 git add "$aumlcdiar" &&
a48fcd83 109 git commit -m initial &&
b560707a
SP
110 git tag initial &&
111 git checkout -b topic &&
112 git mv $aumlcdiar tmp &&
113 git mv tmp "$auml" &&
114 git commit -m rename &&
115 git checkout -f master
116
117'
118
119$test_unicode 'rename (silent unicode normalization)' '
120
121 git mv "$aumlcdiar" "$auml" &&
122 git commit -m rename
123
124'
125
126$test_unicode 'merge (silent unicode normalization)' '
127
128 git reset --hard initial &&
129 git merge topic
130
131'
132
133test_done