diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-02-28 18:53:22 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-03-10 20:10:20 +0000 |
commit | 163db8f2b05ec7e7b57c0ae3779a0abd333b3764 (patch) | |
tree | 9631af325e6b4ef57be68c90cd1df9486103513c | |
parent | 43d7a42bdde3ed137997856c892bbc11abb79bda (diff) | |
download | libgit2-ethomson/canonical.tar.gz |
win32: test relative symlinksethomson/canonical
Ensure that we don't canonicalize symlink targets.
-rw-r--r-- | tests/core/posix.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/core/posix.c b/tests/core/posix.c index 764ca1942..1bb1e9c6b 100644 --- a/tests/core/posix.c +++ b/tests/core/posix.c @@ -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; |