mirror of
https://github.com/git/git.git
synced 2024-11-25 02:44:48 +08:00
704a3143d5
Many tests depend on that symbolic links work. This introduces a check that sets the prerequisite tag SYMLINKS if the file system supports symbolic links. Since so many tests have to check for this prerequisite, we do the check in test-lib.sh, so that we don't need to repeat the test in many scripts. To check for 'ln -s' failures, you can use a FAT partition on Linux: $ mkdosfs -C git-on-fat 1000000 $ sudo mount -o loop,uid=j6t,gid=users,shortname=winnt git-on-fat /mnt Clone git to /mnt and $ GIT_SKIP_TESTS='t0001.1[34] t0010 t1301 t403[34] t4129.[47] t5701.7 t7701.3 t9100 t9101.26 t9119 t9124.[67] t9200.10 t9600.6' \ make test (These additionally skipped tests depend on POSIX permissions that FAT on Linux does not provide.) Signed-off-by: Johannes Sixt <j6t@kdbg.org>
97 lines
2.6 KiB
Bash
Executable File
97 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
#
|
|
|
|
test_description='git checkout-index --prefix test.
|
|
|
|
This test makes sure that --prefix option works as advertised, and
|
|
also verifies that such leading path may contain symlinks, unlike
|
|
the GIT controlled paths.
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success \
|
|
'setup' \
|
|
'mkdir path1 &&
|
|
echo frotz >path0 &&
|
|
echo rezrov >path1/file1 &&
|
|
git update-index --add path0 path1/file1'
|
|
|
|
test_expect_success SYMLINKS \
|
|
'have symlink in place where dir is expected.' \
|
|
'rm -fr path0 path1 &&
|
|
mkdir path2 &&
|
|
ln -s path2 path1 &&
|
|
git checkout-index -f -a &&
|
|
test ! -h path1 && test -d path1 &&
|
|
test -f path1/file1 && test ! -f path2/file1'
|
|
|
|
test_expect_success \
|
|
'use --prefix=path2/' \
|
|
'rm -fr path0 path1 path2 &&
|
|
mkdir path2 &&
|
|
git checkout-index --prefix=path2/ -f -a &&
|
|
test -f path2/path0 &&
|
|
test -f path2/path1/file1 &&
|
|
test ! -f path0 &&
|
|
test ! -f path1/file1'
|
|
|
|
test_expect_success \
|
|
'use --prefix=tmp-' \
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
git checkout-index --prefix=tmp- -f -a &&
|
|
test -f tmp-path0 &&
|
|
test -f tmp-path1/file1 &&
|
|
test ! -f path0 &&
|
|
test ! -f path1/file1'
|
|
|
|
test_expect_success \
|
|
'use --prefix=tmp- but with a conflicting file and dir' \
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
echo nitfol >tmp-path1 &&
|
|
mkdir tmp-path0 &&
|
|
git checkout-index --prefix=tmp- -f -a &&
|
|
test -f tmp-path0 &&
|
|
test -f tmp-path1/file1 &&
|
|
test ! -f path0 &&
|
|
test ! -f path1/file1'
|
|
|
|
# Linus fix #1
|
|
test_expect_success SYMLINKS \
|
|
'use --prefix=tmp/orary/ where tmp is a symlink' \
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
mkdir tmp1 tmp1/orary &&
|
|
ln -s tmp1 tmp &&
|
|
git checkout-index --prefix=tmp/orary/ -f -a &&
|
|
test -d tmp1/orary &&
|
|
test -f tmp1/orary/path0 &&
|
|
test -f tmp1/orary/path1/file1 &&
|
|
test -h tmp'
|
|
|
|
# Linus fix #2
|
|
test_expect_success SYMLINKS \
|
|
'use --prefix=tmp/orary- where tmp is a symlink' \
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
mkdir tmp1 &&
|
|
ln -s tmp1 tmp &&
|
|
git checkout-index --prefix=tmp/orary- -f -a &&
|
|
test -f tmp1/orary-path0 &&
|
|
test -f tmp1/orary-path1/file1 &&
|
|
test -h tmp'
|
|
|
|
# Linus fix #3
|
|
test_expect_success SYMLINKS \
|
|
'use --prefix=tmp- where tmp-path1 is a symlink' \
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
mkdir tmp1 &&
|
|
ln -s tmp1 tmp-path1 &&
|
|
git checkout-index --prefix=tmp- -f -a &&
|
|
test -f tmp-path0 &&
|
|
test ! -h tmp-path1 &&
|
|
test -d tmp-path1 &&
|
|
test -f tmp-path1/file1'
|
|
|
|
test_done
|