@@ -392,7 +392,9 @@ test_expect_success SYMLINKS 'stash file to symlink' '
git stash save "file to symlink" &&
test_path_is_file_not_symlink file &&
test bar = "$(cat file)" &&
- git stash apply
+ git stash apply &&
+ test_path_is_symlink file &&
+ test "$(test_readlink file)" = file2
'
test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
@@ -402,7 +404,9 @@ test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
git stash save "file to symlink (stage rm)" &&
test_path_is_file_not_symlink file &&
test bar = "$(cat file)" &&
- git stash apply
+ git stash apply &&
+ test_path_is_symlink file &&
+ test "$(test_readlink file)" = file2
'
test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
@@ -413,7 +417,9 @@ test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
git stash save "file to symlink (full stage)" &&
test_path_is_file_not_symlink file &&
test bar = "$(cat file)" &&
- git stash apply
+ git stash apply &&
+ test_path_is_symlink file &&
+ test "$(test_readlink file)" = file2
'
# This test creates a commit with a symlink used for the following tests
@@ -859,9 +859,9 @@ test_path_is_file () {
test_path_is_file_not_symlink () {
test "$#" -ne 1 && BUG "1 param"
test_path_is_file "$1" &&
- if ! test ! -h "$1"
+ if test -h "$1"
then
- echo "$1 is a symbolic link"
+ echo "$1 shouldn't be a symbolic link"
false
fi
}
@@ -878,9 +878,9 @@ test_path_is_dir () {
test_path_is_dir_not_symlink () {
test "$#" -ne 1 && BUG "1 param"
test_path_is_dir "$1" &&
- if ! test ! -h "$1"
+ if test -h "$1"
then
- echo "$1 is a symbolic link"
+ echo "$1 shouldn't be a symbolic link"
false
fi
}
@@ -894,6 +894,15 @@ test_path_exists () {
fi
}
+test_path_is_symlink () {
+ test "$#" -ne 1 && BUG "1 param"
+ if ! test -h "$1"
+ then
+ echo "Symbolic link $1 doesn't exist"
+ false
+ fi
+}
+
--
2.25.1