3 test_description
='Various filesystem issues'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK
=true
11 auml
=$
(printf '\303\244')
12 aumlcdiar
=$
(printf '\141\314\210')
14 if test_have_prereq CASE_INSENSITIVE_FS
16 say
"will test on a case insensitive filesystem"
17 test_case
=test_expect_failure
19 test_case
=test_expect_success
22 if test_have_prereq UTF8_NFD_TO_NFC
24 say
"will test on a unicode corrupting filesystem"
25 test_unicode
=test_expect_failure
27 test_unicode
=test_expect_success
30 test_have_prereq SYMLINKS ||
31 say
"will test on a filesystem lacking symbolic links"
33 if test_have_prereq CASE_INSENSITIVE_FS
35 test_expect_success
"detection of case insensitive filesystem during repo init" '
36 test $(git config --bool core.ignorecase) = true
39 test_expect_success
"detection of case insensitive filesystem during repo init" '
41 test_must_fail git config --bool core.ignorecase >/dev/null ||
42 test $(git config --bool core.ignorecase) = false
47 if test_have_prereq SYMLINKS
49 test_expect_success
"detection of filesystem w/o symlink support during repo init" '
51 test_must_fail git config --bool core.symlinks ||
52 test "$(git config --bool core.symlinks)" = true
56 test_expect_success
"detection of filesystem w/o symlink support during repo init" '
57 v=$(git config --bool core.symlinks) &&
62 test_expect_success
"setup case tests" '
63 git config core.ignorecase true &&
66 git commit -m "initial" &&
68 git checkout -b topic &&
69 git mv camelcase tmp &&
70 git mv tmp CamelCase &&
71 git commit -m "rename" &&
75 test_expect_success
'rename (case change)' '
76 git mv camelcase CamelCase &&
77 git commit -m "rename"
80 test_expect_success
'merge (case change)' '
83 git reset --hard initial &&
87 test_expect_success CASE_INSENSITIVE_FS
'add directory (with different case)' '
88 git reset --hard initial &&
92 git add dir1/dir2/a &&
93 git add dir1/DIR2/b &&
94 git ls-files >actual &&
95 cat >expected <<-\EOF &&
100 test_cmp expected actual
103 test_expect_failure CASE_INSENSITIVE_FS
'add (with different case)' '
104 git reset --hard initial &&
109 camel=$(grep -i camelcase tmp) &&
110 test $(echo "$camel" | wc -l) = 1 &&
111 test "z$(git cat-file blob :$camel)" = z1
114 test_expect_success
"setup unicode normalization tests" '
115 test_create_repo unicode &&
117 git config core.precomposeunicode false &&
118 touch "$aumlcdiar" &&
119 git add "$aumlcdiar" &&
120 git commit -m initial &&
122 git checkout -b topic &&
123 git mv $aumlcdiar tmp &&
124 git mv tmp "$auml" &&
125 git commit -m rename &&
129 $test_unicode 'rename (silent unicode normalization)' '
130 git mv "$aumlcdiar" "$auml" &&
134 $test_unicode 'merge (silent unicode normalization)' '
135 git reset --hard initial &&
139 test_expect_success CASE_INSENSITIVE_FS
'checkout with no pathspec and a case insensitive fs' '
146 git commit -m "add Gitweb" &&
148 git checkout --orphan todo &&
150 mkdir -p gitweb/subdir &&
151 >gitweb/subdir/file &&
153 git commit -m "add gitweb/subdir/file" &&