summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/posix_w32.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 2bc93a3c7..29641bdaf 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -439,8 +439,16 @@ int p_symlink(const char *target, const char *path)
git_win32_path target_w, path_w;
DWORD dwFlags;
+ /*
+ * Convert both target and path to Windows-style paths. Note that we do
+ * not want to use `git_win32_path_from_utf8` for converting the target,
+ * as that function will automatically pre-pend the current working
+ * directory in case the path is not absolute. As Git will instead use
+ * relative symlinks, this is not someting we want.
+ */
if (git_win32_path_from_utf8(path_w, path) < 0 ||
- git__utf8_to_16(target_w, MAX_PATH, target) < 0)
+ git__utf8_to_16(target_w, MAX_PATH, target) < 0 ||
+ git_win32_path_canonicalize(target_w) < 0)
return -1;
dwFlags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;