]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[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" '
1c51c7d7
SP
32 test $(git config --bool core.ignorecase) = true
33'
34else
35test_expect_success "detection of case insensitive filesystem during repo init" '
bfe998fc
JK
36 {
37 test_must_fail git config --bool core.ignorecase >/dev/null ||
38 test $(git config --bool core.ignorecase) = false
39 }
1c51c7d7
SP
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" '
bfe998fc
JK
46 {
47 test_must_fail git config --bool core.symlinks ||
48 test "$(git config --bool core.symlinks)" = true
49 }
64e61f2d
JS
50'
51else
52test_expect_success "detection of filesystem w/o symlink support during repo init" '
2b71b522
MG
53 v=$(git config --bool core.symlinks) &&
54 test "$v" = false
64e61f2d
JS
55'
56fi
57
b560707a 58test_expect_success "setup case tests" '
b4a299d8 59 git config core.ignorecase true &&
b560707a
SP
60 touch camelcase &&
61 git add camelcase &&
62 git commit -m "initial" &&
63 git tag initial &&
64 git checkout -b topic &&
65 git mv camelcase tmp &&
66 git mv tmp CamelCase &&
67 git commit -m "rename" &&
68 git checkout -f master
b560707a
SP
69'
70
decd3c0c 71test_expect_success 'rename (case change)' '
b560707a
SP
72 git mv camelcase CamelCase &&
73 git commit -m "rename"
b560707a
SP
74'
75
004c0be7 76test_expect_success 'merge (case change)' '
0047dd2f
SP
77 rm -f CamelCase &&
78 rm -f camelcase &&
b560707a
SP
79 git reset --hard initial &&
80 git merge topic
b560707a
SP
81'
82
c95525e9
BP
83test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' '
84 git reset --hard initial &&
85 mkdir -p dir1/dir2 &&
86 echo >dir1/dir2/a &&
87 echo >dir1/dir2/b &&
88 git add dir1/dir2/a &&
89 git add dir1/DIR2/b &&
90 git ls-files >actual &&
91 cat >expected <<-\EOF &&
92 camelcase
93 dir1/dir2/a
94 dir1/dir2/b
95 EOF
96 test_cmp expected actual
97'
0d7c2430 98
4084475b 99test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '
8a19aaab
SP
100 git reset --hard initial &&
101 rm camelcase &&
102 echo 1 >CamelCase &&
103 git add CamelCase &&
0d7c2430
JH
104 camel=$(git ls-files | grep -i camelcase) &&
105 test $(echo "$camel" | wc -l) = 1 &&
106 test "z$(git cat-file blob :$camel)" = z1
8a19aaab
SP
107'
108
b560707a 109test_expect_success "setup unicode normalization tests" '
336e2e27
TB
110 test_create_repo unicode &&
111 cd unicode &&
92b0c8be 112 git config core.precomposeunicode false &&
336e2e27
TB
113 touch "$aumlcdiar" &&
114 git add "$aumlcdiar" &&
115 git commit -m initial &&
116 git tag initial &&
117 git checkout -b topic &&
118 git mv $aumlcdiar tmp &&
119 git mv tmp "$auml" &&
120 git commit -m rename &&
121 git checkout -f master
b560707a
SP
122'
123
124$test_unicode 'rename (silent unicode normalization)' '
336e2e27
TB
125 git mv "$aumlcdiar" "$auml" &&
126 git commit -m rename
b560707a
SP
127'
128
129$test_unicode 'merge (silent unicode normalization)' '
336e2e27
TB
130 git reset --hard initial &&
131 git merge topic
b560707a
SP
132'
133
69f272b9
EN
134test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case insensitive fs' '
135 git init repo &&
136 (
137 cd repo &&
138
139 >Gitweb &&
140 git add Gitweb &&
141 git commit -m "add Gitweb" &&
142
143 git checkout --orphan todo &&
144 git reset --hard &&
145 mkdir -p gitweb/subdir &&
146 >gitweb/subdir/file &&
147 git add gitweb &&
148 git commit -m "add gitweb/subdir/file" &&
149
150 git checkout master
151 )
152'
153
b560707a 154test_done