Skip to content

Commit 163db8f

Browse files
pks-tethomson
authored andcommitted
win32: test relative symlinks
Ensure that we don't canonicalize symlink targets.
1 parent 43d7a42 commit 163db8f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/core/posix.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,26 @@ void test_core_posix__symlink_resolves_to_correct_type(void)
190190
git_buf_dispose(&contents);
191191
}
192192

193+
void test_core_posix__relative_symlink(void)
194+
{
195+
git_buf contents = GIT_BUF_INIT;
196+
197+
if (!git_path_supports_symlinks(clar_sandbox_path()))
198+
clar__skip();
199+
200+
cl_must_pass(git_futils_mkdir("dir", 0777, 0));
201+
cl_git_mkfile("file", "contents");
202+
cl_git_pass(p_symlink("../file", "dir/link"));
203+
cl_git_pass(git_futils_readbuffer(&contents, "dir/link"));
204+
cl_assert_equal_s(contents.ptr, "contents");
205+
206+
cl_must_pass(p_unlink("file"));
207+
cl_must_pass(p_unlink("dir/link"));
208+
cl_must_pass(p_rmdir("dir"));
209+
210+
git_buf_dispose(&contents);
211+
}
212+
193213
void test_core_posix__symlink_to_file_across_dirs(void)
194214
{
195215
git_buf contents = GIT_BUF_INIT;

0 commit comments

Comments
 (0)