Skip to content

Commit 43d7a42

Browse files
committed
win32: don't canonicalize symlink targets
Don't canonicalize symlink targets; our win32 path canonicalization routines expect an absolute path. In particular, using the path canonicalization routines for symlink targets (introduced in commit 7d55bee, "win32: fix relative symlinks pointing into dirs", 2020-01-10). Now, use the utf8 -> utf16 relative path handling functions, so that paths like "../foo" will be translated to "..\foo".
1 parent f2b114b commit 43d7a42

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/win32/posix_w32.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ int p_symlink(const char *target, const char *path)
447447
* relative symlinks, this is not someting we want.
448448
*/
449449
if (git_win32_path_from_utf8(path_w, path) < 0 ||
450-
git__utf8_to_16(target_w, MAX_PATH, target) < 0 ||
451-
git_win32_path_canonicalize(target_w) < 0)
450+
git_win32_path_relative_from_utf8(target_w, target) < 0)
452451
return -1;
453452

454453
dwFlags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;

0 commit comments

Comments
 (0)