From dda0d3d4797f9dd68620624a097017a8e8b8fce1 Mon Sep 17 00:00:00 2001 From: Michael Geddes Date: Tue, 22 Feb 2011 07:31:13 +0800 Subject: [PATCH] test: Don't have dangling symlinks in tests (for msys) There are 2 reasons for this: * Under windows, ln() must determine whether the target is a directory or a file before creating the link. * msys doesn't handle dangling NTFS symlinks well (for example 'ls' will abort at that point, claiming the file doesn't exist). So I have reordered commands to make sure our symlinks don't dangle from the time of their creation. Signed-off-by: Michael Geddes --- t/t0000-basic.sh | 14 +++++++++++++- t/t1504-ceiling-dirs.sh | 3 ++- t/t2201-add-update-typechange.sh | 3 ++- t/t3010-ls-files-killed-modified.sh | 3 +++ t/t4011-diff-symlink.sh | 3 ++- t/t4023-diff-rename-typechange.sh | 1 + t/t4115-apply-symlink.sh | 4 +++- t/t5000-tar-tree.sh | 1 + 8 files changed, 27 insertions(+), 5 deletions(-) diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index a2bb63ce8e..258cf396bf 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -429,10 +429,22 @@ test_expect_success 'adding various types of objects with git update-index --add for p in $paths do echo "hello $p" >$p || exit 1 + # Create files for msys + path=${p%/*}/ + if [ "${path}" == "${p}/" ] ; then + path= + fi + linkfile="${path}hello $p" + linkpath="${linkfile%/*}" + if [ "${linkpath}" != "${linkfile}" ] ; then + mkdir -p "${linkpath}" + fi + touch "${linkfile}" + test_ln_s_add "hello $p" ${p}sym || exit 1 done ) && - find path* ! -type d -print | xargs git update-index --add + find path* ! -type d -print | grep -v hello| xargs git update-index --add ' # Show them and see that matches what we expect. diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh index 3d51615e42..b1d2319e79 100755 --- a/t/t1504-ceiling-dirs.sh +++ b/t/t1504-ceiling-dirs.sh @@ -44,12 +44,13 @@ test_prefix ceil_at_sub "" GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/" test_prefix ceil_at_sub_slash "" +mkdir -p sub/dir || exit 1 + if test_have_prereq SYMLINKS then ln -s sub top fi -mkdir -p sub/dir || exit 1 cd sub/dir || exit 1 unset GIT_CEILING_DIRECTORIES diff --git a/t/t2201-add-update-typechange.sh b/t/t2201-add-update-typechange.sh index 954fc51e5b..0d98e8bfee 100755 --- a/t/t2201-add-update-typechange.sh +++ b/t/t2201-add-update-typechange.sh @@ -10,6 +10,7 @@ test_expect_success setup ' >yomin && >caskly && if test_have_prereq SYMLINKS; then + touch frotz ln -s frotz nitfol && T_letter=T else @@ -33,13 +34,13 @@ test_expect_success modify ' >nitfol && # rezrov/bozbar disappears rm -fr rezrov && + mkdir xyzzy && if test_have_prereq SYMLINKS; then ln -s xyzzy rezrov else printf %s xyzzy > rezrov fi && # xyzzy disappears (not a submodule) - mkdir xyzzy && echo gnusto >xyzzy/bozbar && # yomin gets replaced with a submodule mkdir yomin && diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh index 6d3b828a95..9291f179f2 100755 --- a/t/t3010-ls-files-killed-modified.sh +++ b/t/t3010-ls-files-killed-modified.sh @@ -80,6 +80,9 @@ test_expect_success 'git ls-files -k to show killed files.' ' date >path3 && date >path5 fi && + touch xyzzy + rm path1 + rm xyzzy mkdir -p path0 path1 path6 pathx/ju && date >path0/file0 && date >path1/file1 && diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh index 13e7f621ab..1f1dc77f26 100755 --- a/t/t4011-diff-symlink.sh +++ b/t/t4011-diff-symlink.sh @@ -31,7 +31,8 @@ test_expect_success 'diff new symlink and file' ' # the empty tree git update-index && tree=$(git write-tree) && - + + touch xyzzy && test_ln_s_add xyzzy frotz && echo xyzzy >nitfol && git update-index --add nitfol && diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh index 55d549fcf4..a4ba040341 100755 --- a/t/t4023-diff-rename-typechange.sh +++ b/t/t4023-diff-rename-typechange.sh @@ -8,6 +8,7 @@ test_expect_success setup ' rm -f foo bar && cat "$TEST_DIRECTORY"/../COPYING >foo && + touch linklink test_ln_s_add linklink bar && git add foo && git commit -a -m Initial && diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh index 872fcda6cb..3b317abcb9 100755 --- a/t/t4115-apply-symlink.sh +++ b/t/t4115-apply-symlink.sh @@ -10,7 +10,8 @@ test_description='git apply symlinks and partial files . ./test-lib.sh test_expect_success setup ' - + mkdir -p path1/path2/path3/path4/ + > path1/path2/path3/path4/path5 test_ln_s_add path1/path2/path3/path4/path5 link1 && git commit -m initial && @@ -18,6 +19,7 @@ test_expect_success setup ' rm -f link? && + > htap6 test_ln_s_add htap6 link1 && git commit -m second && diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 1cf0a4e103..c325893f75 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -105,6 +105,7 @@ test_expect_success \ printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && printf "A not substituted O" >a/substfile2 && if test_have_prereq SYMLINKS; then + > a/a ln -s a a/l1 else printf %s a > a/l1 -- 2.11.4.GIT