Skip to content

Commit

Permalink
squash! Win32: symlink: add test for symlink attribute
Browse files Browse the repository at this point in the history
To verify that the symlink is resolved correctly, we use the fact that
`git.exe` is a native Win32 program, and that `git.exe config -f <path>`
therefore uses the native symlink resolution.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Nov 25, 2019
1 parent a4c71cf commit 3d15d04
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions t/t2040-checkout-symlink-attr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ cache_symlink () {
git update-index --add --cacheinfo 120000,$sha,"$2"
}

# MSYS2 is very forgiving, it will resolve symlinks even if the
# symlink type isn't correct. To make this test meaningful, try
# them with a native, non-MSYS executable.
cat_native () {
filename=$(cygpath -w "$1") &&
cmd.exe /c "type \"$filename\""
}

test_expect_success 'checkout symlinks with attr' '
cache_symlink file1 file-link &&
cache_symlink dir dir-link &&
Expand All @@ -41,11 +33,14 @@ test_expect_success 'checkout symlinks with attr' '
git checkout . &&
mkdir dir &&
echo "contents1" >file1 &&
echo "contents2" >dir/file2 &&
test "$(cat_native file-link)" = "contents1" &&
test "$(cat_native dir-link/file2)" = "contents2"
echo "[a]b=c" >file1 &&
echo "[x]y=z" >dir/file2 &&
# MSYS2 is very forgiving, it will resolve symlinks even if the
# symlink type is incorrect. To make this test meaningful, try
# them with a native, non-MSYS executable, such as `git config`.
test "$(git config -f file-link a.b)" = "c" &&
test "$(git config -f dir-link/file2 x.y)" = "z"
'

test_done

0 comments on commit 3d15d04

Please sign in to comment.