From 9944652c41fb96f555d221865f4ed5d0c8b33514 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 18 Feb 2015 11:07:17 +0000 Subject: [PATCH] fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications. With this commit, the POSIX-to-Windows conversion also leaves Git's `:./` syntax alone. Such a string would otherwise be mistaken for indicating a path list, but path lists are expected to contain only absolute paths, which would not be the case here. This addresses the expectations of the following test cases in the test suite of https://github.com/git/git/tree/v2.43.0: -t1506.4 correct relative file objects (1) -t1506.5 correct relative file objects (2) -t1506.6 correct relative file objects (3) -t1506.7 correct relative file objects (4) -t1506.14 relative path not found -t1506.15 relative path outside worktree -t1506.16 relative path when cwd is outside worktree -t1513.5 empty prefix HEAD:./path -t1513.6 valid prefix HEAD:./path -t1513.7 valid prefix HEAD:../path -t2070.4 restore a file on worktree from another ref -t2070.5 restore a file in the index from another ref -t2070.6 restore a file in both the index and worktree from another ref -t2070.8 restore --worktree --staged uses HEAD as source -t7900.33 start and stop macOS maintenance -t7900.34 use launchctl list to prevent extra work -t7900.35 start and stop Windows maintenance -t7900.36 start and stop Linux/systemd maintenance -t7900.37 start and stop when several schedulers are available -t9300.195 Y: rewrite submodules -t9304.6 import with submodule mapping -t9304.7 paths adjusted for relative subdir Signed-off-by: Johannes Schindelin --- winsup/cygwin/msys2_path_conv.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc index 71c4735c06..0ac47f0261 100644 --- a/winsup/cygwin/msys2_path_conv.cc +++ b/winsup/cygwin/msys2_path_conv.cc @@ -380,6 +380,14 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en // Avoid mangling IPv6 addresses if (it + 1 < end && it[1] == ':') goto skip_p2w; + + // Leave Git's :./name syntax alone + if (it + 1 < end && it[1] == '.') { + if (it + 2 < end && it[2] == '/') + goto skip_p2w; + if (it + 3 < end && it[2] == '.' && it[3] == '/') + goto skip_p2w; + } break; } ++it;