3 test_description
='Various filesystem issues'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10 auml
=$
(printf '\303\244')
11 aumlcdiar
=$
(printf '\141\314\210')
13 if test_have_prereq CASE_INSENSITIVE_FS
15 say
"will test on a case insensitive filesystem"
16 test_case
=test_expect_failure
18 test_case
=test_expect_success
21 if test_have_prereq UTF8_NFD_TO_NFC
23 say
"will test on a unicode corrupting filesystem"
24 test_unicode
=test_expect_failure
26 test_unicode
=test_expect_success
29 test_have_prereq SYMLINKS ||
30 say
"will test on a filesystem lacking symbolic links"
32 if test_have_prereq CASE_INSENSITIVE_FS
34 test_expect_success
"detection of case insensitive filesystem during repo init" '
35 test $(git config --bool core.ignorecase) = true
38 test_expect_success
"detection of case insensitive filesystem during repo init" '
40 test_must_fail git config --bool core.ignorecase >/dev/null ||
41 test $(git config --bool core.ignorecase) = false
46 if test_have_prereq SYMLINKS
48 test_expect_success
"detection of filesystem w/o symlink support during repo init" '
50 test_must_fail git config --bool core.symlinks ||
51 test "$(git config --bool core.symlinks)" = true
55 test_expect_success
"detection of filesystem w/o symlink support during repo init" '
56 v=$(git config --bool core.symlinks) &&
61 test_expect_success
"setup case tests" '
62 git config core.ignorecase true &&
65 git commit -m "initial" &&
67 git checkout -b topic &&
68 git mv camelcase tmp &&
69 git mv tmp CamelCase &&
70 git commit -m "rename" &&
74 test_expect_success
'rename (case change)' '
75 git mv camelcase CamelCase &&
76 git commit -m "rename"
79 test_expect_success
'merge (case change)' '
82 git reset --hard initial &&
86 test_expect_success CASE_INSENSITIVE_FS
'add directory (with different case)' '
87 git reset --hard initial &&
91 git add dir1/dir2/a &&
92 git add dir1/DIR2/b &&
93 git ls-files >actual &&
94 cat >expected <<-\EOF &&
99 test_cmp expected actual
102 test_expect_failure CASE_INSENSITIVE_FS
'add (with different case)' '
103 git reset --hard initial &&
107 camel=$(git ls-files | grep -i camelcase) &&
108 test $(echo "$camel" | wc -l) = 1 &&
109 test "z$(git cat-file blob :$camel)" = z1
112 test_expect_success
"setup unicode normalization tests" '
113 test_create_repo unicode &&
115 git config core.precomposeunicode false &&
116 touch "$aumlcdiar" &&
117 git add "$aumlcdiar" &&
118 git commit -m initial &&
120 git checkout -b topic &&
121 git mv $aumlcdiar tmp &&
122 git mv tmp "$auml" &&
123 git commit -m rename &&
127 $test_unicode 'rename (silent unicode normalization)' '
128 git mv "$aumlcdiar" "$auml" &&
132 $test_unicode 'merge (silent unicode normalization)' '
133 git reset --hard initial &&
137 test_expect_success CASE_INSENSITIVE_FS
'checkout with no pathspec and a case insensitive fs' '
144 git commit -m "add Gitweb" &&
146 git checkout --orphan todo &&
148 mkdir -p gitweb/subdir &&
149 >gitweb/subdir/file &&
151 git commit -m "add gitweb/subdir/file" &&