]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
help: make sure local html page exists before calling external processes
[thirdparty/git.git] / t / t0050-filesystem.sh
CommitLineData
b560707a
SP
1#!/bin/sh
2
3test_description='Various filesystem issues'
4
06d53148 5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
b560707a
SP
8. ./test-lib.sh
9
77e57265
JN
10auml=$(printf '\303\244')
11aumlcdiar=$(printf '\141\314\210')
b560707a 12
9a3658b9
MG
13if test_have_prereq CASE_INSENSITIVE_FS
14then
5b46a428 15 say "will test on a case insensitive filesystem"
9a3658b9
MG
16 test_case=test_expect_failure
17else
18 test_case=test_expect_success
19fi
20
5b0b5dd4
MG
21if test_have_prereq UTF8_NFD_TO_NFC
22then
5b46a428 23 say "will test on a unicode corrupting filesystem"
5b0b5dd4
MG
24 test_unicode=test_expect_failure
25else
26 test_unicode=test_expect_success
27fi
28
2b71b522 29test_have_prereq SYMLINKS ||
64e61f2d 30 say "will test on a filesystem lacking symbolic links"
5b46a428 31
9a3658b9 32if test_have_prereq CASE_INSENSITIVE_FS
1c51c7d7
SP
33then
34test_expect_success "detection of case insensitive filesystem during repo init" '
1c51c7d7
SP
35 test $(git config --bool core.ignorecase) = true
36'
37else
38test_expect_success "detection of case insensitive filesystem during repo init" '
bfe998fc
JK
39 {
40 test_must_fail git config --bool core.ignorecase >/dev/null ||
41 test $(git config --bool core.ignorecase) = false
42 }
1c51c7d7
SP
43'
44fi
45
2b71b522 46if test_have_prereq SYMLINKS
64e61f2d
JS
47then
48test_expect_success "detection of filesystem w/o symlink support during repo init" '
bfe998fc
JK
49 {
50 test_must_fail git config --bool core.symlinks ||
51 test "$(git config --bool core.symlinks)" = true
52 }
64e61f2d
JS
53'
54else
55test_expect_success "detection of filesystem w/o symlink support during repo init" '
2b71b522
MG
56 v=$(git config --bool core.symlinks) &&
57 test "$v" = false
64e61f2d
JS
58'
59fi
60
b560707a 61test_expect_success "setup case tests" '
b4a299d8 62 git config core.ignorecase true &&
b560707a
SP
63 touch camelcase &&
64 git add camelcase &&
65 git commit -m "initial" &&
66 git tag initial &&
67 git checkout -b topic &&
68 git mv camelcase tmp &&
69 git mv tmp CamelCase &&
70 git commit -m "rename" &&
06d53148 71 git checkout -f main
b560707a
SP
72'
73
decd3c0c 74test_expect_success 'rename (case change)' '
b560707a
SP
75 git mv camelcase CamelCase &&
76 git commit -m "rename"
b560707a
SP
77'
78
004c0be7 79test_expect_success 'merge (case change)' '
0047dd2f
SP
80 rm -f CamelCase &&
81 rm -f camelcase &&
b560707a
SP
82 git reset --hard initial &&
83 git merge topic
b560707a
SP
84'
85
c95525e9
BP
86test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' '
87 git reset --hard initial &&
88 mkdir -p dir1/dir2 &&
89 echo >dir1/dir2/a &&
90 echo >dir1/dir2/b &&
91 git add dir1/dir2/a &&
92 git add dir1/DIR2/b &&
93 git ls-files >actual &&
94 cat >expected <<-\EOF &&
95 camelcase
96 dir1/dir2/a
97 dir1/dir2/b
98 EOF
99 test_cmp expected actual
100'
0d7c2430 101
4084475b 102test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '
8a19aaab
SP
103 git reset --hard initial &&
104 rm camelcase &&
105 echo 1 >CamelCase &&
106 git add CamelCase &&
0d7c2430
JH
107 camel=$(git ls-files | grep -i camelcase) &&
108 test $(echo "$camel" | wc -l) = 1 &&
109 test "z$(git cat-file blob :$camel)" = z1
8a19aaab
SP
110'
111
b560707a 112test_expect_success "setup unicode normalization tests" '
336e2e27
TB
113 test_create_repo unicode &&
114 cd unicode &&
92b0c8be 115 git config core.precomposeunicode false &&
336e2e27
TB
116 touch "$aumlcdiar" &&
117 git add "$aumlcdiar" &&
118 git commit -m initial &&
119 git tag initial &&
120 git checkout -b topic &&
121 git mv $aumlcdiar tmp &&
122 git mv tmp "$auml" &&
123 git commit -m rename &&
06d53148 124 git checkout -f main
b560707a
SP
125'
126
127$test_unicode 'rename (silent unicode normalization)' '
336e2e27
TB
128 git mv "$aumlcdiar" "$auml" &&
129 git commit -m rename
b560707a
SP
130'
131
132$test_unicode 'merge (silent unicode normalization)' '
336e2e27
TB
133 git reset --hard initial &&
134 git merge topic
b560707a
SP
135'
136
69f272b9
EN
137test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case insensitive fs' '
138 git init repo &&
139 (
140 cd repo &&
141
142 >Gitweb &&
143 git add Gitweb &&
144 git commit -m "add Gitweb" &&
145
146 git checkout --orphan todo &&
147 git reset --hard &&
148 mkdir -p gitweb/subdir &&
149 >gitweb/subdir/file &&
150 git add gitweb &&
151 git commit -m "add gitweb/subdir/file" &&
152
06d53148 153 git checkout main
69f272b9
EN
154 )
155'
156
b560707a 157test_done