2008-02-24 20:19:09 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='Various filesystem issues'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2010-12-21 23:27:55 +03:00
|
|
|
auml=$(printf '\303\244')
|
|
|
|
aumlcdiar=$(printf '\141\314\210')
|
2008-02-24 20:19:09 +03:00
|
|
|
|
2008-05-11 20:16:40 +04:00
|
|
|
case_insensitive=
|
2009-03-18 00:45:22 +03:00
|
|
|
unibad=
|
2009-03-04 21:40:27 +03:00
|
|
|
no_symlinks=
|
|
|
|
test_expect_success 'see what we expect' '
|
2008-02-24 20:19:09 +03:00
|
|
|
|
2010-10-31 04:46:54 +03:00
|
|
|
test_case=test_expect_success &&
|
|
|
|
test_unicode=test_expect_success &&
|
2008-02-24 20:19:09 +03:00
|
|
|
mkdir junk &&
|
|
|
|
echo good >junk/CamelCase &&
|
|
|
|
echo bad >junk/camelcase &&
|
|
|
|
if test "$(cat junk/CamelCase)" != good
|
|
|
|
then
|
2010-10-31 04:46:54 +03:00
|
|
|
test_case=test_expect_failure &&
|
2008-05-11 20:16:40 +04:00
|
|
|
case_insensitive=t
|
2008-02-24 20:19:09 +03:00
|
|
|
fi &&
|
|
|
|
rm -fr junk &&
|
|
|
|
mkdir junk &&
|
|
|
|
>junk/"$auml" &&
|
|
|
|
case "$(cd junk && echo *)" in
|
|
|
|
"$aumlcdiar")
|
2010-10-31 04:46:54 +03:00
|
|
|
test_unicode=test_expect_failure &&
|
2009-03-18 00:45:22 +03:00
|
|
|
unibad=t
|
2008-02-24 20:19:09 +03:00
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac &&
|
2009-03-04 21:40:27 +03:00
|
|
|
rm -fr junk &&
|
|
|
|
{
|
|
|
|
ln -s x y 2> /dev/null &&
|
|
|
|
test -h y 2> /dev/null ||
|
2010-10-31 04:46:54 +03:00
|
|
|
no_symlinks=1 &&
|
2009-03-04 21:40:27 +03:00
|
|
|
rm -f y
|
|
|
|
}
|
2008-02-24 20:19:09 +03:00
|
|
|
'
|
|
|
|
|
2009-03-18 00:45:22 +03:00
|
|
|
test "$case_insensitive" &&
|
|
|
|
say "will test on a case insensitive filesystem"
|
|
|
|
test "$unibad" &&
|
|
|
|
say "will test on a unicode corrupting filesystem"
|
2009-03-04 21:40:27 +03:00
|
|
|
test "$no_symlinks" &&
|
|
|
|
say "will test on a filesystem lacking symbolic links"
|
2009-03-18 00:45:22 +03:00
|
|
|
|
2008-05-11 20:16:40 +04:00
|
|
|
if test "$case_insensitive"
|
|
|
|
then
|
|
|
|
test_expect_success "detection of case insensitive filesystem during repo init" '
|
|
|
|
|
|
|
|
test $(git config --bool core.ignorecase) = true
|
|
|
|
'
|
|
|
|
else
|
|
|
|
test_expect_success "detection of case insensitive filesystem during repo init" '
|
|
|
|
|
2008-07-12 19:47:52 +04:00
|
|
|
test_must_fail git config --bool core.ignorecase >/dev/null ||
|
2008-05-11 20:16:40 +04:00
|
|
|
test $(git config --bool core.ignorecase) = false
|
|
|
|
'
|
|
|
|
fi
|
|
|
|
|
2009-03-04 21:40:27 +03:00
|
|
|
if test "$no_symlinks"
|
|
|
|
then
|
|
|
|
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
|
|
|
|
|
|
|
v=$(git config --bool core.symlinks) &&
|
|
|
|
test "$v" = false
|
|
|
|
'
|
|
|
|
else
|
|
|
|
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
|
|
|
|
|
|
|
test_must_fail git config --bool core.symlinks ||
|
|
|
|
test "$(git config --bool core.symlinks)" = true
|
|
|
|
'
|
|
|
|
fi
|
|
|
|
|
2008-02-24 20:19:09 +03:00
|
|
|
test_expect_success "setup case tests" '
|
|
|
|
|
2008-05-11 20:16:41 +04:00
|
|
|
git config core.ignorecase true &&
|
2008-02-24 20:19:09 +03:00
|
|
|
touch camelcase &&
|
|
|
|
git add camelcase &&
|
|
|
|
git commit -m "initial" &&
|
|
|
|
git tag initial &&
|
|
|
|
git checkout -b topic &&
|
|
|
|
git mv camelcase tmp &&
|
|
|
|
git mv tmp CamelCase &&
|
|
|
|
git commit -m "rename" &&
|
|
|
|
git checkout -f master
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
$test_case 'rename (case change)' '
|
|
|
|
|
|
|
|
git mv camelcase CamelCase &&
|
|
|
|
git commit -m "rename"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
$test_case 'merge (case change)' '
|
|
|
|
|
2008-05-15 09:19:54 +04:00
|
|
|
rm -f CamelCase &&
|
|
|
|
rm -f camelcase &&
|
2008-02-24 20:19:09 +03:00
|
|
|
git reset --hard initial &&
|
|
|
|
git merge topic
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2010-03-01 10:31:21 +03:00
|
|
|
|
|
|
|
|
|
|
|
test_expect_failure 'add (with different case)' '
|
2008-05-11 20:16:42 +04:00
|
|
|
|
|
|
|
git reset --hard initial &&
|
|
|
|
rm camelcase &&
|
|
|
|
echo 1 >CamelCase &&
|
|
|
|
git add CamelCase &&
|
2010-03-01 10:31:21 +03:00
|
|
|
camel=$(git ls-files | grep -i camelcase) &&
|
|
|
|
test $(echo "$camel" | wc -l) = 1 &&
|
|
|
|
test "z$(git cat-file blob :$camel)" = z1
|
2008-05-11 20:16:42 +04:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2008-02-24 20:19:09 +03:00
|
|
|
test_expect_success "setup unicode normalization tests" '
|
|
|
|
|
|
|
|
test_create_repo unicode &&
|
|
|
|
cd unicode &&
|
|
|
|
touch "$aumlcdiar" &&
|
|
|
|
git add "$aumlcdiar" &&
|
2010-10-31 04:46:54 +03:00
|
|
|
git commit -m initial &&
|
2008-02-24 20:19:09 +03:00
|
|
|
git tag initial &&
|
|
|
|
git checkout -b topic &&
|
|
|
|
git mv $aumlcdiar tmp &&
|
|
|
|
git mv tmp "$auml" &&
|
|
|
|
git commit -m rename &&
|
|
|
|
git checkout -f master
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
$test_unicode 'rename (silent unicode normalization)' '
|
|
|
|
|
|
|
|
git mv "$aumlcdiar" "$auml" &&
|
|
|
|
git commit -m rename
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
$test_unicode 'merge (silent unicode normalization)' '
|
|
|
|
|
|
|
|
git reset --hard initial &&
|
|
|
|
git merge topic
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|