Skip to content

Commit

Permalink
win32: test relative symlinks
Browse files Browse the repository at this point in the history
Ensure that we don't canonicalize symlink targets.
  • Loading branch information
pks-t authored and ethomson committed Mar 10, 2020
1 parent 43d7a42 commit 163db8f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/core/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,26 @@ void test_core_posix__symlink_resolves_to_correct_type(void)
git_buf_dispose(&contents);
}

void test_core_posix__relative_symlink(void)
{
git_buf contents = GIT_BUF_INIT;

if (!git_path_supports_symlinks(clar_sandbox_path()))
clar__skip();

cl_must_pass(git_futils_mkdir("dir", 0777, 0));
cl_git_mkfile("file", "contents");
cl_git_pass(p_symlink("../file", "dir/link"));
cl_git_pass(git_futils_readbuffer(&contents, "dir/link"));
cl_assert_equal_s(contents.ptr, "contents");

cl_must_pass(p_unlink("file"));
cl_must_pass(p_unlink("dir/link"));
cl_must_pass(p_rmdir("dir"));

git_buf_dispose(&contents);
}

void test_core_posix__symlink_to_file_across_dirs(void)
{
git_buf contents = GIT_BUF_INIT;
Expand Down

0 comments on commit 163db8f

Please sign in to comment.