MSYS2-packages/msys2-runtime-3.5/0047-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
Johannes Schindelin 96ef9fc317 msys2-runtime-3.5: branch off of msys2-runtime
Cygwin v3.5.0 has been released end of January 2024, and we were _about_
to be on the brink to switch to MSYS2 runtime based on the Cygwin
runtime v3.5.x.

However:

- That would leave Windows 7/8 compatibility behind.
- There have been a couple of hiccups in our testing, which led us to
  skip v3.5.0 already.
- We determined that a safer way would be to let users opt into using
  v3.5.x first, kicking the tires, so to say.

So let's establish a `msys2-runtime-3.5` package (much like
`msys2-runtime-3.3`) to be able to easily revert to a known state really
quickly, including the ability to run on Windows 7.

For now, this is merely a verbatim copy of the files in `msys2-runtime`,
and the next commits will modify them to reflect the version bump.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2024-03-10 00:02:00 +01:00

64 lines
2.2 KiB
Diff

From e9a55f1ac61a079533fa01a3dad2b65e721d13f3 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
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 <johannes.schindelin@gmx.de>
---
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;
}
}