Use prerequisite tags to skip tests that depend on symbolic links

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>
This commit is contained in:
Johannes Sixt 2009-03-04 22:38:24 +01:00
parent 7b7247b0d7
commit 704a3143d5
32 changed files with 211 additions and 76 deletions

View File

@ -115,12 +115,31 @@ test_expect_success \
'test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904' 'test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904'
# Various types of objects # Various types of objects
# Some filesystems do not support symblic links; on such systems
# some expected values are different
mkdir path2 path3 path3/subp3 mkdir path2 path3 path3/subp3
for p in path0 path2/file2 path3/file3 path3/subp3/file3 paths='path0 path2/file2 path3/file3 path3/subp3/file3'
for p in $paths
do do
echo "hello $p" >$p echo "hello $p" >$p
ln -s "hello $p" ${p}sym
done done
if test_have_prereq SYMLINKS
then
for p in $paths
do
ln -s "hello $p" ${p}sym
done
expectfilter=cat
expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
else
expectfilter='grep -v sym'
expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
fi
test_expect_success \ test_expect_success \
'adding various types of objects with git update-index --add.' \ 'adding various types of objects with git update-index --add.' \
'find path* ! -type d -print | xargs git update-index --add' 'find path* ! -type d -print | xargs git update-index --add'
@ -130,7 +149,7 @@ test_expect_success \
'showing stage with git ls-files --stage' \ 'showing stage with git ls-files --stage' \
'git ls-files --stage >current' 'git ls-files --stage >current'
cat >expected <<\EOF $expectfilter >expected <<\EOF
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0 100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
@ -149,7 +168,7 @@ test_expect_success \
'tree=$(git write-tree)' 'tree=$(git write-tree)'
test_expect_success \ test_expect_success \
'validate object ID for a known tree.' \ 'validate object ID for a known tree.' \
'test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b' 'test "$tree" = "$expectedtree"'
test_expect_success \ test_expect_success \
'showing tree with git ls-tree' \ 'showing tree with git ls-tree' \
@ -160,7 +179,7 @@ cat >expected <<\EOF
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2 040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
EOF EOF
test_expect_success \ test_expect_success SYMLINKS \
'git ls-tree output for a known tree.' \ 'git ls-tree output for a known tree.' \
'test_cmp expected current' 'test_cmp expected current'
@ -169,7 +188,7 @@ test_expect_success \
test_expect_success \ test_expect_success \
'showing tree with git ls-tree -r' \ 'showing tree with git ls-tree -r' \
'git ls-tree -r $tree >current' 'git ls-tree -r $tree >current'
cat >expected <<\EOF $expectfilter >expected <<\EOF
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2 100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
@ -200,7 +219,7 @@ cat >expected <<\EOF
100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3 100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
EOF EOF
test_expect_success \ test_expect_success SYMLINKS \
'git ls-tree -r output for a known tree.' \ 'git ls-tree -r output for a known tree.' \
'test_cmp expected current' 'test_cmp expected current'
@ -209,14 +228,14 @@ test_expect_success \
'ptree=$(git write-tree --prefix=path3)' 'ptree=$(git write-tree --prefix=path3)'
test_expect_success \ test_expect_success \
'validate object ID for a known tree.' \ 'validate object ID for a known tree.' \
'test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3' 'test "$ptree" = "$expectedptree1"'
test_expect_success \ test_expect_success \
'writing partial tree out with git write-tree --prefix.' \ 'writing partial tree out with git write-tree --prefix.' \
'ptree=$(git write-tree --prefix=path3/subp3)' 'ptree=$(git write-tree --prefix=path3/subp3)'
test_expect_success \ test_expect_success \
'validate object ID for a known tree.' \ 'validate object ID for a known tree.' \
'test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2' 'test "$ptree" = "$expectedptree2"'
cat >badobjects <<EOF cat >badobjects <<EOF
100644 blob 1000000000000000000000000000000000000000 dir/file1 100644 blob 1000000000000000000000000000000000000000 dir/file1
@ -249,7 +268,7 @@ test_expect_success \
newtree=$(git write-tree) && newtree=$(git write-tree) &&
test "$newtree" = "$tree"' test "$newtree" = "$tree"'
cat >expected <<\EOF $expectfilter >expected <<\EOF
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0 :100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym :120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2 :100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
@ -272,7 +291,7 @@ test_expect_success \
'git diff-files >current && cmp -s current /dev/null' 'git diff-files >current && cmp -s current /dev/null'
################################################################ ################################################################
P=087704a96baf1c2d1c869a8b084481e121c88b5b P=$expectedtree
test_expect_success \ test_expect_success \
'git commit-tree records the correct tree in a commit.' \ 'git commit-tree records the correct tree in a commit.' \
'commit0=$(echo NO | git commit-tree $P) && 'commit0=$(echo NO | git commit-tree $P) &&
@ -308,7 +327,7 @@ test_expect_success 'update-index D/F conflict' '
test $numpath0 = 1 test $numpath0 = 1
' '
test_expect_success 'absolute path works as expected' ' test_expect_success SYMLINKS 'absolute path works as expected' '
mkdir first && mkdir first &&
ln -s ../.git first/.git && ln -s ../.git first/.git &&
mkdir second && mkdir second &&

View File

@ -4,7 +4,7 @@ test_description='update-index and add refuse to add beyond symlinks'
. ./test-lib.sh . ./test-lib.sh
test_expect_success setup ' test_expect_success SYMLINKS setup '
>a && >a &&
mkdir b && mkdir b &&
ln -s b c && ln -s b c &&
@ -12,12 +12,12 @@ test_expect_success setup '
git update-index --add a b/d git update-index --add a b/d
' '
test_expect_success 'update-index --add beyond symlinks' ' test_expect_success SYMLINKS 'update-index --add beyond symlinks' '
test_must_fail git update-index --add c/d && test_must_fail git update-index --add c/d &&
! ( git ls-files | grep c/d ) ! ( git ls-files | grep c/d )
' '
test_expect_success 'add beyond symlinks' ' test_expect_success SYMLINKS 'add beyond symlinks' '
test_must_fail git add c/d && test_must_fail git add c/d &&
! ( git ls-files | grep c/d ) ! ( git ls-files | grep c/d )
' '

View File

@ -157,7 +157,7 @@ test_expect_success '3-way not overwriting local changes (their side)' '
' '
test_expect_success 'funny symlink in work tree' ' test_expect_success SYMLINKS 'funny symlink in work tree' '
git reset --hard && git reset --hard &&
git checkout -b sym-b side-b && git checkout -b sym-b side-b &&
@ -177,7 +177,7 @@ test_expect_success 'funny symlink in work tree' '
' '
test_expect_success 'funny symlink in work tree, un-unlink-able' ' test_expect_success SYMLINKS 'funny symlink in work tree, un-unlink-able' '
rm -fr a b && rm -fr a b &&
git reset --hard && git reset --hard &&
@ -189,7 +189,7 @@ test_expect_success 'funny symlink in work tree, un-unlink-able' '
' '
# clean-up from the above test # clean-up from the above test
chmod a+w a chmod a+w a 2>/dev/null
rm -fr a b rm -fr a b
test_expect_success 'D/F setup' ' test_expect_success 'D/F setup' '

View File

@ -126,7 +126,7 @@ test_expect_success 'no file/rev ambiguity check inside a bare repo' '
cd foo.git && git show -s HEAD cd foo.git && git show -s HEAD
' '
test_expect_success 'detection should not be fooled by a symlink' ' test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
cd "$HERE" && cd "$HERE" &&
rm -fr foo.git && rm -fr foo.git &&
git clone -s .git another && git clone -s .git another &&

View File

@ -726,7 +726,7 @@ echo >>result
test_expect_success '--null --get-regexp' 'cmp result expect' test_expect_success '--null --get-regexp' 'cmp result expect'
test_expect_success 'symlinked configuration' ' test_expect_success SYMLINKS 'symlinked configuration' '
ln -s notyet myconfig && ln -s notyet myconfig &&
GIT_CONFIG=myconfig git config test.frotz nitfol && GIT_CONFIG=myconfig git config test.frotz nitfol &&

View File

@ -59,10 +59,10 @@ test_expect_success \
'git read-tree -m $tree1 && git checkout-index -f -a' 'git read-tree -m $tree1 && git checkout-index -f -a'
test_debug 'show_files $tree1' test_debug 'show_files $tree1'
ln -s path0 path1 test_expect_success SYMLINKS \
test_expect_success \
'git update-index --add a symlink.' \ 'git update-index --add a symlink.' \
'git update-index --add path1' 'ln -s path0 path1 &&
git update-index --add path1'
test_expect_success \ test_expect_success \
'writing tree out with git write-tree' \ 'writing tree out with git write-tree' \
'tree3=$(git write-tree)' 'tree3=$(git write-tree)'

View File

@ -19,7 +19,7 @@ test_expect_success \
echo rezrov >path1/file1 && echo rezrov >path1/file1 &&
git update-index --add path0 path1/file1' git update-index --add path0 path1/file1'
test_expect_success \ test_expect_success SYMLINKS \
'have symlink in place where dir is expected.' \ 'have symlink in place where dir is expected.' \
'rm -fr path0 path1 && 'rm -fr path0 path1 &&
mkdir path2 && mkdir path2 &&
@ -59,7 +59,7 @@ test_expect_success \
test ! -f path1/file1' test ! -f path1/file1'
# Linus fix #1 # Linus fix #1
test_expect_success \ test_expect_success SYMLINKS \
'use --prefix=tmp/orary/ where tmp is a symlink' \ 'use --prefix=tmp/orary/ where tmp is a symlink' \
'rm -fr path0 path1 path2 tmp* && 'rm -fr path0 path1 path2 tmp* &&
mkdir tmp1 tmp1/orary && mkdir tmp1 tmp1/orary &&
@ -71,7 +71,7 @@ test_expect_success \
test -h tmp' test -h tmp'
# Linus fix #2 # Linus fix #2
test_expect_success \ test_expect_success SYMLINKS \
'use --prefix=tmp/orary- where tmp is a symlink' \ 'use --prefix=tmp/orary- where tmp is a symlink' \
'rm -fr path0 path1 path2 tmp* && 'rm -fr path0 path1 path2 tmp* &&
mkdir tmp1 && mkdir tmp1 &&
@ -82,7 +82,7 @@ test_expect_success \
test -h tmp' test -h tmp'
# Linus fix #3 # Linus fix #3
test_expect_success \ test_expect_success SYMLINKS \
'use --prefix=tmp- where tmp-path1 is a symlink' \ 'use --prefix=tmp- where tmp-path1 is a symlink' \
'rm -fr path0 path1 path2 tmp* && 'rm -fr path0 path1 path2 tmp* &&
mkdir tmp1 && mkdir tmp1 &&

View File

@ -194,7 +194,7 @@ test_expect_success \
test $(cat ../$s1) = tree1asubdir/path5) test $(cat ../$s1) = tree1asubdir/path5)
)' )'
test_expect_success \ test_expect_success SYMLINKS \
'checkout --temp symlink' ' 'checkout --temp symlink' '
rm -f path* .merge_* out .git/index && rm -f path* .merge_* out .git/index &&
ln -s b a && ln -s b a &&

View File

@ -6,6 +6,12 @@ test_description='git checkout to switch between branches with symlink<->dir'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say "symbolic links not supported - skipping tests"
test_done
fi
test_expect_success setup ' test_expect_success setup '
mkdir frotz && mkdir frotz &&

View File

@ -26,7 +26,12 @@ All of the attempts should fail.
mkdir path2 path3 mkdir path2 path3
date >path0 date >path0
ln -s xyzzy path1 if test_have_prereq SYMLINKS
then
ln -s xyzzy path1
else
date > path1
fi
date >path2/file2 date >path2/file2
date >path3/file3 date >path3/file3
@ -38,7 +43,12 @@ rm -fr path?
mkdir path0 path1 mkdir path0 path1
date >path2 date >path2
ln -s frotz path3 if test_have_prereq SYMLINKS
then
ln -s frotz path3
else
date > path3
fi
date >path0/file0 date >path0/file0
date >path1/file1 date >path1/file1

View File

@ -80,7 +80,7 @@ test_expect_success 'change gets noticed' '
' '
test_expect_success 'replace a file with a symlink' ' test_expect_success SYMLINKS 'replace a file with a symlink' '
rm foo && rm foo &&
ln -s top foo && ln -s top foo &&

View File

@ -11,7 +11,13 @@ test_expect_success setup '
_empty=$(git hash-object --stdin <xyzzy) && _empty=$(git hash-object --stdin <xyzzy) &&
>yomin && >yomin &&
>caskly && >caskly &&
ln -s frotz nitfol && if test_have_prereq SYMLINKS; then
ln -s frotz nitfol &&
T_letter=T
else
printf %s frotz > nitfol &&
T_letter=M
fi &&
mkdir rezrov && mkdir rezrov &&
>rezrov/bozbar && >rezrov/bozbar &&
git add caskly xyzzy yomin nitfol rezrov/bozbar && git add caskly xyzzy yomin nitfol rezrov/bozbar &&
@ -29,7 +35,11 @@ test_expect_success modify '
>nitfol && >nitfol &&
# rezrov/bozbar disappears # rezrov/bozbar disappears
rm -fr rezrov && rm -fr rezrov &&
ln -s xyzzy rezrov && if test_have_prereq SYMLINKS; then
ln -s xyzzy rezrov
else
printf %s xyzzy > rezrov
fi &&
# xyzzy disappears (not a submodule) # xyzzy disappears (not a submodule)
mkdir xyzzy && mkdir xyzzy &&
echo gnusto >xyzzy/bozbar && echo gnusto >xyzzy/bozbar &&
@ -71,7 +81,7 @@ test_expect_success modify '
s/blob/000000/ s/blob/000000/
} }
/ nitfol/{ / nitfol/{
s/ nitfol/ $_z40 T&/ s/ nitfol/ $_z40 $T_letter&/
s/blob/100644/ s/blob/100644/
} }
/ rezrov.bozbar/{ / rezrov.bozbar/{

View File

@ -5,7 +5,7 @@ test_description='cd_to_toplevel'
. ./test-lib.sh . ./test-lib.sh
test_cd_to_toplevel () { test_cd_to_toplevel () {
test_expect_success "$2" ' test_expect_success $3 "$2" '
( (
cd '"'$1'"' && cd '"'$1'"' &&
. git-sh-setup && . git-sh-setup &&
@ -24,14 +24,14 @@ test_cd_to_toplevel repo 'at physical root'
test_cd_to_toplevel repo/sub/dir 'at physical subdir' test_cd_to_toplevel repo/sub/dir 'at physical subdir'
ln -s repo symrepo ln -s repo symrepo 2>/dev/null
test_cd_to_toplevel symrepo 'at symbolic root' test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
ln -s repo/sub/dir subdir-link ln -s repo/sub/dir subdir-link 2>/dev/null
test_cd_to_toplevel subdir-link 'at symbolic subdir' test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
cd repo cd repo
ln -s sub/dir internal-link ln -s sub/dir internal-link 2>/dev/null
test_cd_to_toplevel internal-link 'at internal symbolic subdir' test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS
test_done test_done

View File

@ -17,7 +17,12 @@ filesystem.
. ./test-lib.sh . ./test-lib.sh
date >path0 date >path0
ln -s xyzzy path1 if test_have_prereq SYMLINKS
then
ln -s xyzzy path1
else
date > path1
fi
mkdir path2 path3 mkdir path2 path3
date >path2/file2 date >path2/file2
date >path2-junk date >path2-junk

View File

@ -38,7 +38,12 @@ modified without reporting path9 and path10.
. ./test-lib.sh . ./test-lib.sh
date >path0 date >path0
ln -s xyzzy path1 if test_have_prereq SYMLINKS
then
ln -s xyzzy path1
else
date > path1
fi
mkdir path2 path3 mkdir path2 path3
date >path2/file2 date >path2/file2
date >path3/file3 date >path3/file3
@ -52,8 +57,14 @@ test_expect_success \
rm -fr path? ;# leave path10 alone rm -fr path? ;# leave path10 alone
date >path2 date >path2
ln -s frotz path3 if test_have_prereq SYMLINKS
ln -s nitfol path5 then
ln -s frotz path3
ln -s nitfol path5
else
date > path3
date > path5
fi
mkdir path0 path1 path6 mkdir path0 path1 path6
date >path0/file0 date >path0/file0
date >path1/file1 date >path1/file1

View File

@ -22,9 +22,21 @@ test_expect_success \
'setup' \ 'setup' \
'mkdir path2 path2/baz && 'mkdir path2 path2/baz &&
echo Hi >path0 && echo Hi >path0 &&
ln -s path0 path1 && if test_have_prereq SYMLINKS
then
ln -s path0 path1 &&
ln -s ../path1 path2/bazbo
make_expected () {
cat >expected
}
else
printf path0 > path1 &&
printf ../path1 > path2/bazbo
make_expected () {
sed -e "s/120000 /100644 /" >expected
}
fi &&
echo Lo >path2/foo && echo Lo >path2/foo &&
ln -s ../path1 path2/bazbo &&
echo Mi >path2/baz/b && echo Mi >path2/baz/b &&
find path? \( -type f -o -type l \) -print | find path? \( -type f -o -type l \) -print |
xargs git update-index --add && xargs git update-index --add &&
@ -41,7 +53,7 @@ test_output () {
test_expect_success \ test_expect_success \
'ls-tree plain' \ 'ls-tree plain' \
'git ls-tree $tree >current && 'git ls-tree $tree >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
040000 tree X path2 040000 tree X path2
@ -51,7 +63,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree recursive' \ 'ls-tree recursive' \
'git ls-tree -r $tree >current && 'git ls-tree -r $tree >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
100644 blob X path2/baz/b 100644 blob X path2/baz/b
@ -63,7 +75,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree recursive with -t' \ 'ls-tree recursive with -t' \
'git ls-tree -r -t $tree >current && 'git ls-tree -r -t $tree >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
040000 tree X path2 040000 tree X path2
@ -77,7 +89,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree recursive with -d' \ 'ls-tree recursive with -d' \
'git ls-tree -r -d $tree >current && 'git ls-tree -r -d $tree >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
040000 tree X path2 040000 tree X path2
040000 tree X path2/baz 040000 tree X path2/baz
EOF EOF
@ -86,7 +98,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path' \ 'ls-tree filtered with path' \
'git ls-tree $tree path >current && 'git ls-tree $tree path >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
EOF EOF
test_output' test_output'
@ -96,7 +108,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path1 path0' \ 'ls-tree filtered with path1 path0' \
'git ls-tree $tree path1 path0 >current && 'git ls-tree $tree path1 path0 >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
100644 blob X path0 100644 blob X path0
120000 blob X path1 120000 blob X path1
EOF EOF
@ -105,7 +117,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path0/' \ 'ls-tree filtered with path0/' \
'git ls-tree $tree path0/ >current && 'git ls-tree $tree path0/ >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
EOF EOF
test_output' test_output'
@ -114,7 +126,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path2' \ 'ls-tree filtered with path2' \
'git ls-tree $tree path2 >current && 'git ls-tree $tree path2 >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
040000 tree X path2 040000 tree X path2
EOF EOF
test_output' test_output'
@ -123,7 +135,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path2/' \ 'ls-tree filtered with path2/' \
'git ls-tree $tree path2/ >current && 'git ls-tree $tree path2/ >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
040000 tree X path2/baz 040000 tree X path2/baz
120000 blob X path2/bazbo 120000 blob X path2/bazbo
100644 blob X path2/foo 100644 blob X path2/foo
@ -135,7 +147,7 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path2/baz' \ 'ls-tree filtered with path2/baz' \
'git ls-tree $tree path2/baz >current && 'git ls-tree $tree path2/baz >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
040000 tree X path2/baz 040000 tree X path2/baz
EOF EOF
test_output' test_output'
@ -143,14 +155,14 @@ EOF
test_expect_success \ test_expect_success \
'ls-tree filtered with path2/bak' \ 'ls-tree filtered with path2/bak' \
'git ls-tree $tree path2/bak >current && 'git ls-tree $tree path2/bak >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
EOF EOF
test_output' test_output'
test_expect_success \ test_expect_success \
'ls-tree -t filtered with path2/bak' \ 'ls-tree -t filtered with path2/bak' \
'git ls-tree -t $tree path2/bak >current && 'git ls-tree -t $tree path2/bak >current &&
cat >expected <<\EOF && make_expected <<\EOF &&
040000 tree X path2 040000 tree X path2
EOF EOF
test_output' test_output'

View File

@ -121,7 +121,7 @@ test_expect_success 'renaming a symref is not allowed' \
! test -f .git/refs/heads/master3 ! test -f .git/refs/heads/master3
' '
test_expect_success \ test_expect_success SYMLINKS \
'git branch -m u v should fail when the reflog for u is a symlink' ' 'git branch -m u v should fail when the reflog for u is a symlink' '
git branch -l u && git branch -l u &&
mv .git/logs/refs/heads/u real-u && mv .git/logs/refs/heads/u real-u &&

View File

@ -30,7 +30,7 @@ test_expect_success \
*) echo fail; git ls-files --stage xfoo1; (exit 1);; *) echo fail; git ls-files --stage xfoo1; (exit 1);;
esac' esac'
test_expect_success 'git add: filemode=0 should not get confused by symlink' ' test_expect_success SYMLINKS 'git add: filemode=0 should not get confused by symlink' '
rm -f xfoo1 && rm -f xfoo1 &&
ln -s foo xfoo1 && ln -s foo xfoo1 &&
git add xfoo1 && git add xfoo1 &&
@ -51,7 +51,7 @@ test_expect_success \
*) echo fail; git ls-files --stage xfoo2; (exit 1);; *) echo fail; git ls-files --stage xfoo2; (exit 1);;
esac' esac'
test_expect_success 'git add: filemode=0 should not get confused by symlink' ' test_expect_success SYMLINKS 'git add: filemode=0 should not get confused by symlink' '
rm -f xfoo2 && rm -f xfoo2 &&
ln -s foo xfoo2 && ln -s foo xfoo2 &&
git update-index --add xfoo2 && git update-index --add xfoo2 &&
@ -61,7 +61,7 @@ test_expect_success 'git add: filemode=0 should not get confused by symlink' '
esac esac
' '
test_expect_success \ test_expect_success SYMLINKS \
'git update-index --add: Test that executable bit is not used...' \ 'git update-index --add: Test that executable bit is not used...' \
'git config core.filemode 0 && 'git config core.filemode 0 &&
ln -s xfoo2 xfoo3 && ln -s xfoo2 xfoo3 &&

View File

@ -12,6 +12,13 @@ by an edit for them.
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
test_expect_success \ test_expect_success \
'prepare reference tree' \ 'prepare reference tree' \
'echo xyzzy | tr -d '\\\\'012 >yomin && 'echo xyzzy | tr -d '\\\\'012 >yomin &&

View File

@ -99,7 +99,7 @@ test_expect_success \
'validate result of -B -M (#4)' \ 'validate result of -B -M (#4)' \
'compare_diff_raw expected current' 'compare_diff_raw expected current'
test_expect_success \ test_expect_success SYMLINKS \
'make file0 into something completely different' \ 'make file0 into something completely different' \
'rm -f file0 && 'rm -f file0 &&
ln -s frotz file0 && ln -s frotz file0 &&
@ -114,7 +114,7 @@ cat >expected <<\EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M100 file1 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M100 file1
EOF EOF
test_expect_success \ test_expect_success SYMLINKS \
'validate result of -B (#5)' \ 'validate result of -B (#5)' \
'compare_diff_raw expected current' 'compare_diff_raw expected current'
@ -129,7 +129,7 @@ cat >expected <<\EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 R file0 file1 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 R file0 file1
EOF EOF
test_expect_success \ test_expect_success SYMLINKS \
'validate result of -B -M (#6)' \ 'validate result of -B -M (#6)' \
'compare_diff_raw expected current' 'compare_diff_raw expected current'
@ -144,7 +144,7 @@ cat >expected <<\EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M file1 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M file1
EOF EOF
test_expect_success \ test_expect_success SYMLINKS \
'validate result of -M (#7)' \ 'validate result of -M (#7)' \
'compare_diff_raw expected current' 'compare_diff_raw expected current'

View File

@ -9,6 +9,13 @@ test_description='Test diff of symlinks.
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
cat > expected << EOF cat > expected << EOF
diff --git a/frotz b/frotz diff --git a/frotz b/frotz
new file mode 120000 new file mode 120000

View File

@ -4,6 +4,13 @@ test_description='typechange rename detection'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
test_expect_success setup ' test_expect_success setup '
rm -f foo bar && rm -f foo bar &&

View File

@ -9,6 +9,13 @@ test_description='git apply should not get confused with type changes.
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
test_expect_success 'setup repository and commits' ' test_expect_success 'setup repository and commits' '
echo "hello world" > foo && echo "hello world" > foo &&
echo "hi planet" > bar && echo "hi planet" > bar &&

View File

@ -9,6 +9,13 @@ test_description='git apply symlinks and partial files
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
test_expect_success setup ' test_expect_success setup '
ln -s path1/path2/path3/path4/path5 link1 && ln -s path1/path2/path3/path4/path5 link1 &&

View File

@ -3,6 +3,13 @@
test_description='apply to deeper directory without getting fooled with symlink' test_description='apply to deeper directory without getting fooled with symlink'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
lecho () { lecho () {
for l_ for l_
do do

View File

@ -37,7 +37,11 @@ test_expect_success \
cp /bin/sh a/bin && cp /bin/sh a/bin &&
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
printf "A not substituted O" >a/substfile2 && printf "A not substituted O" >a/substfile2 &&
ln -s a a/l1 && if test_have_prereq SYMLINKS; then
ln -s a a/l1
else
printf %s a > a/l1
fi &&
(p=long_path_to_a_file && cd a && (p=long_path_to_a_file && cd a &&
for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
echo text >file_with_long_path) && echo text >file_with_long_path) &&

View File

@ -4,6 +4,13 @@ test_description='pulling from symlinked subdir'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq SYMLINKS
then
say 'Symbolic links not supported, skipping tests.'
test_done
exit
fi
# The scenario we are building: # The scenario we are building:
# #
# trash\ directory/ # trash\ directory/

View File

@ -206,7 +206,7 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
rm -f dirty dirty2 rm -f dirty dirty2
test_expect_success 'git mv should overwrite symlink to a file' ' test_expect_success SYMLINKS 'git mv should overwrite symlink to a file' '
rm -fr .git && rm -fr .git &&
git init && git init &&
@ -225,7 +225,7 @@ test_expect_success 'git mv should overwrite symlink to a file' '
rm -f moved symlink rm -f moved symlink
test_expect_success 'git mv should overwrite file with a symlink' ' test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
rm -fr .git && rm -fr .git &&
git init && git init &&

View File

@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \
test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar' test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
test_expect_success 'get "bar" => symlink fix from svn' \ test_expect_success 'get "bar" => symlink fix from svn' \
'(cd x && git svn rebase)' '(cd x && git svn rebase)'
test_expect_success '"bar" becomes a symlink' 'test -L x/bar' test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -L x/bar'
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y' test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'

View File

@ -85,7 +85,7 @@ EOF
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x' test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x'
test_expect_success '"bar" is a symlink that points to "asdf"' ' test_expect_success SYMLINKS '"bar" is a symlink that points to "asdf"' '
test -L x/bar && test -L x/bar &&
(cd x && test xasdf = x"`git cat-file blob HEAD:bar`") (cd x && test xasdf = x"`git cat-file blob HEAD:bar`")
' '
@ -94,7 +94,7 @@ test_expect_success 'get "bar" => symlink fix from svn' '
(cd x && git svn rebase) (cd x && git svn rebase)
' '
test_expect_success '"bar" remains a proper symlink' ' test_expect_success SYMLINKS '"bar" remains a proper symlink' '
test -L x/bar && test -L x/bar &&
(cd x && test xdoink = x"`git cat-file blob HEAD:bar`") (cd x && test xdoink = x"`git cat-file blob HEAD:bar`")
' '

View File

@ -246,7 +246,7 @@ test_expect_success \
gitweb_run "p=.git;a=commitdiff"' gitweb_run "p=.git;a=commitdiff"'
test_debug 'cat gitweb.log' test_debug 'cat gitweb.log'
test_expect_success \ test_expect_success SYMLINKS \
'commitdiff(0): file to symlink' \ 'commitdiff(0): file to symlink' \
'rm renamed_file && 'rm renamed_file &&
ln -s file renamed_file && ln -s file renamed_file &&
@ -308,7 +308,7 @@ test_debug 'cat gitweb.log'
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# commitdiff testing (taken from t4114-apply-typechange.sh) # commitdiff testing (taken from t4114-apply-typechange.sh)
test_expect_success 'setup typechange commits' ' test_expect_success SYMLINKS 'setup typechange commits' '
echo "hello world" > foo && echo "hello world" > foo &&
echo "hi planet" > bar && echo "hi planet" > bar &&
git update-index --add foo bar && git update-index --add foo bar &&
@ -418,7 +418,12 @@ test_expect_success \
git mv 04-rename-from 04-rename-to && git mv 04-rename-from 04-rename-to &&
echo "Changed" >> 04-rename-to && echo "Changed" >> 04-rename-to &&
test_chmod +x 05-mode-change && test_chmod +x 05-mode-change &&
rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink && rm -f 06-file-or-symlink &&
if test_have_prereq SYMLINKS; then
ln -s 01-change 06-file-or-symlink
else
printf %s 01-change > 06-file-or-symlink
fi &&
echo "Changed and have mode changed" > 07-change-mode-change && echo "Changed and have mode changed" > 07-change-mode-change &&
test_chmod +x 07-change-mode-change && test_chmod +x 07-change-mode-change &&
git commit -a -m "Large commit" && git commit -a -m "Large commit" &&

View File

@ -689,3 +689,7 @@ case $(uname -s) in
} }
;; ;;
esac esac
# test whether the filesystem supports symbolic links
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
rm -f y