Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit dda0d3d

Browse files
committed
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 <[email protected]>
1 parent 4d733b9 commit dda0d3d

8 files changed

+27
-5
lines changed

t/t0000-basic.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,22 @@ test_expect_success 'adding various types of objects with git update-index --add
429429
for p in $paths
430430
do
431431
echo "hello $p" >$p || exit 1
432+
# Create files for msys
433+
path=${p%/*}/
434+
if [ "${path}" == "${p}/" ] ; then
435+
path=
436+
fi
437+
linkfile="${path}hello $p"
438+
linkpath="${linkfile%/*}"
439+
if [ "${linkpath}" != "${linkfile}" ] ; then
440+
mkdir -p "${linkpath}"
441+
fi
442+
touch "${linkfile}"
443+
432444
test_ln_s_add "hello $p" ${p}sym || exit 1
433445
done
434446
) &&
435-
find path* ! -type d -print | xargs git update-index --add
447+
find path* ! -type d -print | grep -v hello| xargs git update-index --add
436448
'
437449

438450
# Show them and see that matches what we expect.

t/t1504-ceiling-dirs.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ test_prefix ceil_at_sub ""
4444
GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/"
4545
test_prefix ceil_at_sub_slash ""
4646

47+
mkdir -p sub/dir || exit 1
48+
4749
if test_have_prereq SYMLINKS
4850
then
4951
ln -s sub top
5052
fi
5153

52-
mkdir -p sub/dir || exit 1
5354
cd sub/dir || exit 1
5455

5556
unset GIT_CEILING_DIRECTORIES

t/t2201-add-update-typechange.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test_expect_success setup '
1010
>yomin &&
1111
>caskly &&
1212
if test_have_prereq SYMLINKS; then
13+
touch frotz
1314
ln -s frotz nitfol &&
1415
T_letter=T
1516
else
@@ -33,13 +34,13 @@ test_expect_success modify '
3334
>nitfol &&
3435
# rezrov/bozbar disappears
3536
rm -fr rezrov &&
37+
mkdir xyzzy &&
3638
if test_have_prereq SYMLINKS; then
3739
ln -s xyzzy rezrov
3840
else
3941
printf %s xyzzy > rezrov
4042
fi &&
4143
# xyzzy disappears (not a submodule)
42-
mkdir xyzzy &&
4344
echo gnusto >xyzzy/bozbar &&
4445
# yomin gets replaced with a submodule
4546
mkdir yomin &&

t/t3010-ls-files-killed-modified.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ test_expect_success 'git ls-files -k to show killed files.' '
8080
date >path3 &&
8181
date >path5
8282
fi &&
83+
touch xyzzy
84+
rm path1
85+
rm xyzzy
8386
mkdir -p path0 path1 path6 pathx/ju &&
8487
date >path0/file0 &&
8588
date >path1/file1 &&

t/t4011-diff-symlink.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ test_expect_success 'diff new symlink and file' '
3131
# the empty tree
3232
git update-index &&
3333
tree=$(git write-tree) &&
34-
34+
35+
touch xyzzy &&
3536
test_ln_s_add xyzzy frotz &&
3637
echo xyzzy >nitfol &&
3738
git update-index --add nitfol &&

t/t4023-diff-rename-typechange.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_expect_success setup '
88
99
rm -f foo bar &&
1010
cat "$TEST_DIRECTORY"/../COPYING >foo &&
11+
touch linklink
1112
test_ln_s_add linklink bar &&
1213
git add foo &&
1314
git commit -a -m Initial &&

t/t4115-apply-symlink.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ test_description='git apply symlinks and partial files
1010
. ./test-lib.sh
1111

1212
test_expect_success setup '
13-
13+
mkdir -p path1/path2/path3/path4/
14+
> path1/path2/path3/path4/path5
1415
test_ln_s_add path1/path2/path3/path4/path5 link1 &&
1516
git commit -m initial &&
1617
1718
git branch side &&
1819
1920
rm -f link? &&
2021
22+
> htap6
2123
test_ln_s_add htap6 link1 &&
2224
git commit -m second &&
2325

t/t5000-tar-tree.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ test_expect_success \
105105
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
106106
printf "A not substituted O" >a/substfile2 &&
107107
if test_have_prereq SYMLINKS; then
108+
> a/a
108109
ln -s a a/l1
109110
else
110111
printf %s a > a/l1

0 commit comments

Comments
 (0)