MSYS2-packages/msys2-runtime-3.5/0042-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

146 lines
6.8 KiB
Diff

From cfc7696e0825563fb4245377ab70887cde160cd1 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Sun, 22 Feb 2015 18:33:48 +0100
Subject: [PATCH 42/N] fixup! Add functionality for converting UNIX paths in
arguments and environment variables to Windows form for native Win32
applications.
With this change, MSYS2's path conversion leaves paths containing any
special characters alone.
This addresses the expectations of the following test cases in the test
suite of https://github.com/git/git/tree/v2.43.0:
-t1091.13 set sparse-checkout using builtin
-t1092.82 grep sparse directory within submodules
-t1402.56 ref name '*/foo' is valid with options --refspec-pattern
-t1402.57 ref name '*/foo' is valid with options --refspec-pattern --allow-onelevel
-t1402.59 ref name '*/foo' is valid with options --refspec-pattern --normalize
-t3001.25 ls-files with "**" patterns
-t3001.26 ls-files with "**" patterns and --directory
-t3070.423 wildmatch: match 'foo' '**/foo'
-t3070.425 iwildmatch: match 'foo' '**/foo'
-t3070.433 wildmatch: match 'XXX/foo' '**/foo'
-t3070.435 iwildmatch: match 'XXX/foo' '**/foo'
-t3070.437 pathmatch: match 'XXX/foo' '**/foo'
-t3070.439 ipathmatch: match 'XXX/foo' '**/foo'
-t3070.443 wildmatch: match 'bar/baz/foo' '**/foo'
-t3070.445 iwildmatch: match 'bar/baz/foo' '**/foo'
-t3070.447 pathmatch: match 'bar/baz/foo' '**/foo'
-t3070.449 ipathmatch: match 'bar/baz/foo' '**/foo'
-t3070.457 pathmatch: match 'bar/baz/foo' '*/foo'
-t3070.459 ipathmatch: match 'bar/baz/foo' '*/foo'
-t3070.467 pathmatch: match 'foo/bar/baz' '**/bar*'
-t3070.469 ipathmatch: match 'foo/bar/baz' '**/bar*'
-t3070.473 wildmatch: match 'deep/foo/bar/baz' '**/bar/*'
-t3070.475 iwildmatch: match 'deep/foo/bar/baz' '**/bar/*'
-t3070.477 pathmatch: match 'deep/foo/bar/baz' '**/bar/*'
-t3070.479 ipathmatch: match 'deep/foo/bar/baz' '**/bar/*'
-t3070.487 pathmatch: match 'deep/foo/bar/baz/' '**/bar/*'
-t3070.489 ipathmatch: match 'deep/foo/bar/baz/' '**/bar/*'
-t3070.493 wildmatch: match 'deep/foo/bar/baz/' '**/bar/**'
-t3070.495 iwildmatch: match 'deep/foo/bar/baz/' '**/bar/**'
-t3070.497 pathmatch: match 'deep/foo/bar/baz/' '**/bar/**'
-t3070.499 ipathmatch: match 'deep/foo/bar/baz/' '**/bar/**'
-t3070.513 wildmatch: match 'deep/foo/bar/' '**/bar/**'
-t3070.515 iwildmatch: match 'deep/foo/bar/' '**/bar/**'
-t3070.517 pathmatch: match 'deep/foo/bar/' '**/bar/**'
-t3070.519 ipathmatch: match 'deep/foo/bar/' '**/bar/**'
-t3070.527 pathmatch: match 'foo/bar/baz' '**/bar**'
-t3070.529 ipathmatch: match 'foo/bar/baz' '**/bar**'
-t3070.533 wildmatch: match 'foo/bar/baz/x' '*/bar/**'
-t3070.535 iwildmatch: match 'foo/bar/baz/x' '*/bar/**'
-t3070.537 pathmatch: match 'foo/bar/baz/x' '*/bar/**'
-t3070.539 ipathmatch: match 'foo/bar/baz/x' '*/bar/**'
-t3070.547 pathmatch: match 'deep/foo/bar/baz/x' '*/bar/**'
-t3070.549 ipathmatch: match 'deep/foo/bar/baz/x' '*/bar/**'
-t3070.553 wildmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
-t3070.555 iwildmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
-t3070.557 pathmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
-t3070.559 ipathmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
-t3070.633 wildmatch: match 'XXX/\' '*/\\'
-t3070.635 iwildmatch: match 'XXX/\' '*/\\'
-t3070.637 pathmatch: match 'XXX/\' '*/\\'
-t3070.639 ipathmatch: match 'XXX/\' '*/\\'
-t3070.763 wildmatch: match 'foo/bar/baz/to' '**/t[o]'
-t3070.765 iwildmatch: match 'foo/bar/baz/to' '**/t[o]'
-t3070.767 pathmatch: match 'foo/bar/baz/to' '**/t[o]'
-t3070.769 ipathmatch: match 'foo/bar/baz/to' '**/t[o]'
-t3070.1493 wildmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
-t3070.1495 iwildmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
-t3070.1497 pathmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
-t3070.1499 ipathmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
-t3070.1533 wildmatch: match 'foo/bba/arr' '*/*/*'
-t3070.1535 iwildmatch: match 'foo/bba/arr' '*/*/*'
-t3070.1537 pathmatch: match 'foo/bba/arr' '*/*/*'
-t3070.1539 ipathmatch: match 'foo/bba/arr' '*/*/*'
-t3070.1547 pathmatch: match 'foo/bb/aa/rr' '*/*/*'
-t3070.1549 ipathmatch: match 'foo/bb/aa/rr' '*/*/*'
-t3070.1553 wildmatch: match 'foo/bb/aa/rr' '**/**/**'
-t3070.1555 iwildmatch: match 'foo/bb/aa/rr' '**/**/**'
-t3070.1557 pathmatch: match 'foo/bb/aa/rr' '**/**/**'
-t3070.1559 ipathmatch: match 'foo/bb/aa/rr' '**/**/**'
-t3070.1583 wildmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
-t3070.1585 iwildmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
-t3070.1587 pathmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
-t3070.1589 ipathmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
-t3070.1593 wildmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
-t3070.1595 iwildmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
-t3070.1597 pathmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
-t3070.1599 ipathmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
-t5500.154 fetch-pack --diag-url ./[::1]:repo
-t5500.156 fetch-pack --diag-url ./[::1]:23:repo
-t5500.165 fetch-pack --diag-url [::1]:/~repo
-t5500.251 fetch-pack --diag-url ./[::1]:re:po
-t5500.253 fetch-pack --diag-url ./[::1]:23:re:po
-t5500.262 fetch-pack --diag-url [::1]:/~re:po
-t5500.348 fetch-pack --diag-url ./[::1]:re/po
-t5500.350 fetch-pack --diag-url ./[::1]:23:re/po
-t5500.358 fetch-pack --diag-url [::1]:re/po
-t5500.359 fetch-pack --diag-url [::1]:/~re/po
-t5601.63 clone [::1]:rep/home/project
-t5601.66 clone [::1]:/~repo
-t6018.17 rev-parse --exclude with --branches
-t6018.85 rev-list --exclude with --branches
-t6130.20 **/ works with --glob-pathspecs
-t7817.1 setup
-t7817.2 working tree grep honors sparse checkout
-t7817.3 grep searches unmerged file despite not matching sparsity patterns
-t7817.5 grep --recurse-submodules honors sparse checkout in submodule
-t7817.7 working tree grep does not search the index with CE_VALID and SKIP_WORKTREE
-t9902.55 __git_refs - full refs
-t9902.58 __git_refs - remote on local file system - full refs
-t9902.75 __git refs - excluding full refs
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/msys2_path_conv.cc | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
index 8870d38..2646dc0 100644
--- a/winsup/cygwin/msys2_path_conv.cc
+++ b/winsup/cygwin/msys2_path_conv.cc
@@ -362,6 +362,21 @@ skip_p2w:
if (*it == ':')
goto skip_p2w;
+ while (it != end && *it) {
+ switch (*it) {
+ case '`':
+ case '\'':
+ case '"':
+ case '*':
+ case '?':
+ case '[':
+ case ']':
+ goto skip_p2w;
+ }
+ ++it;
+ }
+ it = *src;
+
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
recurse = true;
it = ++*src;