From e9a55f1ac61a079533fa01a3dad2b65e721d13f3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 18 Feb 2015 11:07:17 +0000 Subject: [PATCH 47/N] fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications. Let's prevent scp-style arguments from being mangled by MSYS2's path conversion. An argument like `me@example.com:/tmp/` is not something we should convert into a Windows path; Use the absence of a slash before the colon as a tell-tale that it is *not* a POSIX path list (exception: if the part left of the colon is `.` or `..`). This addresses the expectations of the following test cases in the test suite of https://github.com/git/git/tree/v2.43.0: -t5516.8 fetch with insteadOf -t5516.16 push with insteadOf -t5516.17 push with pushInsteadOf -t5602.2 clone calls git upload-pack unqualified with no -u option -t5602.3 clone calls specified git upload-pack with -u option -t5603.31 clone of host:/ goes to host (non-bare) -t5603.35 clone of user@host:/ goes to host (non-bare) -t5813.81 full paths still work 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 0976cf9..1e9cdbe 100644 --- a/winsup/cygwin/msys2_path_conv.cc +++ b/winsup/cygwin/msys2_path_conv.cc @@ -470,6 +470,8 @@ skip_p2w: int starts_with_minus = 0; int starts_with_minus_alpha = 0; + int only_dots = *it == '.'; + int has_slashes = 0; if (*it == '-') { starts_with_minus = 1; it += 1; @@ -513,11 +515,17 @@ skip_p2w: if (ch == '/' && *(it2 + 1) == '/') { return URL; } else { + if (!only_dots && !has_slashes) + goto skip_p2w; return POSIX_PATH_LIST; } } else if (memchr(it2, '=', end - it2) == NULL) { return SIMPLE_WINDOWS_PATH; } + } else if (ch != '.') { + only_dots = 0; + if (ch == '/' || ch == '\\') + has_slashes = 1; } }