2008-02-24 18:19:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='Various filesystem issues'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2008-03-12 22:30:10 +01:00
|
|
|
auml=`printf '\xc3\xa4'`
|
|
|
|
aumlcdiar=`printf '\x61\xcc\x88'`
|
2008-02-24 18:19:09 +01:00
|
|
|
|
2008-05-11 18:16:40 +02:00
|
|
|
case_insensitive=
|
2009-03-17 22:45:22 +01:00
|
|
|
unibad=
|
2009-03-04 19:40:27 +01:00
|
|
|
no_symlinks=
|
|
|
|
test_expect_success 'see what we expect' '
|
2008-02-24 18:19:09 +01:00
|
|
|
|
|
|
|
test_case=test_expect_success
|
|
|
|
test_unicode=test_expect_success
|
|
|
|
mkdir junk &&
|
|
|
|
echo good >junk/CamelCase &&
|
|
|
|
echo bad >junk/camelcase &&
|
|
|
|
if test "$(cat junk/CamelCase)" != good
|
|
|
|
then
|
|
|
|
test_case=test_expect_failure
|
2008-05-11 18:16:40 +02:00
|
|
|
case_insensitive=t
|
2008-02-24 18:19:09 +01:00
|
|
|
fi &&
|
|
|
|
rm -fr junk &&
|
|
|
|
mkdir junk &&
|
|
|
|
>junk/"$auml" &&
|
|
|
|
case "$(cd junk && echo *)" in
|
|
|
|
"$aumlcdiar")
|
|
|
|
test_unicode=test_expect_failure
|
2009-03-17 22:45:22 +01:00
|
|
|
unibad=t
|
2008-02-24 18:19:09 +01:00
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac &&
|
2009-03-04 19:40:27 +01:00
|
|
|
rm -fr junk &&
|
|
|
|
{
|
|
|
|
ln -s x y 2> /dev/null &&
|
|
|
|
test -h y 2> /dev/null ||
|
|
|
|
no_symlinks=1
|
|
|
|
rm -f y
|
|
|
|
}
|
2008-02-24 18:19:09 +01:00
|
|
|
'
|
|
|
|
|
2009-03-17 22:45:22 +01: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 19:40:27 +01:00
|
|
|
test "$no_symlinks" &&
|
|
|
|
say "will test on a filesystem lacking symbolic links"
|
2009-03-17 22:45:22 +01:00
|
|
|
|
2008-05-11 18:16:40 +02: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 17:47:52 +02:00
|
|
|
test_must_fail git config --bool core.ignorecase >/dev/null ||
|
2008-05-11 18:16:40 +02:00
|
|
|
test $(git config --bool core.ignorecase) = false
|
|
|
|
'
|
|
|
|
fi
|
|
|
|
|
2009-03-04 19:40:27 +01: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 18:19:09 +01:00
|
|
|
test_expect_success "setup case tests" '
|
|
|
|
|
2008-05-11 18:16:41 +02:00
|
|
|
git config core.ignorecase true &&
|
2008-02-24 18:19:09 +01: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 07:19:54 +02:00
|
|
|
rm -f CamelCase &&
|
|
|
|
rm -f camelcase &&
|
2008-02-24 18:19:09 +01:00
|
|
|
git reset --hard initial &&
|
|
|
|
git merge topic
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2008-05-11 18:16:42 +02:00
|
|
|
$test_case 'add (with different case)' '
|
|
|
|
|
|
|
|
git reset --hard initial &&
|
|
|
|
rm camelcase &&
|
|
|
|
echo 1 >CamelCase &&
|
|
|
|
git add CamelCase &&
|
2008-09-03 10:59:27 +02:00
|
|
|
test $(git ls-files | grep -i camelcase | wc -l) = 1
|
2008-05-11 18:16:42 +02:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2008-02-24 18:19:09 +01:00
|
|
|
test_expect_success "setup unicode normalization tests" '
|
|
|
|
|
|
|
|
test_create_repo unicode &&
|
|
|
|
cd unicode &&
|
|
|
|
touch "$aumlcdiar" &&
|
|
|
|
git add "$aumlcdiar" &&
|
|
|
|
git commit -m initial
|
|
|
|
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
|