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

89 lines
3.9 KiB
Diff

From 4b20e4fc67735ce82bb47c60a6e8f46bbcb33127 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 41/N] fixup! Add functionality for converting UNIX paths in
arguments and environment variables to Windows form for native Win32
applications.
Let's teach MSYS2's path conversion to leave Git's :name and :/message
arguments alone, please. These arguments start with colons and are hence
unlikely to contain a path list (a path list starting with a colon would
start with an empty item?!?).
Without this patch, you will see this:
$ GIT_TRACE=1 /c/Program\ Files/Git/cmd/git version :/message
13:48:44.258390 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
13:48:44.269314 git.c:463 trace: built-in: git version ';C:\msys64\message'
git version 2.43.0.windows.1
In other words, the argument `:/message` is mangled in an undesired way.
This addresses the expectations of the following test cases in the test
suite of https://github.com/git/git/tree/v2.43.0:
-t0060.81 <drive-letter>:\\abc is an absolute path
-t1501.35 Auto discovery
-t1501.36 $GIT_DIR/common overrides core.worktree
-t1501.37 $GIT_WORK_TREE overrides $GIT_DIR/common
-t1506.3 correct relative file objects (0)
-t1506.8 correct relative file objects (5)
-t1506.9 correct relative file objects (6)
-t2070.7 restore --staged uses HEAD as source
-t3013.16 git ls-files --format with relative path
-t3400.6 rebase, with <onto> and <upstream> specified as :/quuxery
-t3404.84 rebase -i, with <onto> and <upstream> specified as :/quuxery
-t3703.2 add :/
-t3703.3 add :/anothersub
-t4202.8 oneline
-t4202.22 git log --no-walk <commits> sorts by commit time
-t4202.23 git log --no-walk=sorted <commits> sorts by commit time
-t4202.24 git log --line-prefix="=== " --no-walk <commits> sorts by commit time
-t4202.25 git log --no-walk=unsorted <commits> leaves list of commits as given
-t4202.26 git show <commits> leaves list of commits as given
-t4202.138 log --source paints branch names
-t4202.139 log --source paints tag names
-t4202.140 log --source paints symmetric ranges
-t4208.2 "git log :/" should not be ambiguous
-t4208.3 "git log :/a" should be ambiguous (applied both rev and worktree)
-t4208.4 "git log :/a -- " should not be ambiguous
-t4208.5 "git log :/detached -- " should find a commit only in HEAD
-t4208.7 "git log :/detached -- " should find HEAD only of own worktree
-t4208.10 "git log :/in" should not be ambiguous
-t4208.13 git log HEAD -- :/
-t5616.43 lazy-fetch in submodule succeeds
-t6132.7 t_e_i() exclude sub2 from sub
-t6132.14 m_p_d() exclude sub2 from sub
-t6132.19 grep --untracked PATTERN
-t6132.21 grep --untracked PATTERN :(exclude)*FILE
-t6133.6 :/*.t from a subdir dwims to a pathspec
-t7201.14 checkout to detach HEAD with :/message
-t9903.37 prompt - untracked files status indicator - untracked files
-t9903.39 prompt - untracked files status indicator - non-empty untracked dir
-t9903.40 prompt - untracked files status indicator - untracked files outside cwd
-t9903.44 prompt - untracked files status indicator - shell variable set with config enabled
-t9903.56 prompt - bash color pc mode - untracked files status indicator
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/msys2_path_conv.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
index 35b7757..8870d38 100644
--- a/winsup/cygwin/msys2_path_conv.cc
+++ b/winsup/cygwin/msys2_path_conv.cc
@@ -356,6 +356,12 @@ skip_p2w:
return NONE;
}
+ /*
+ * Prevent Git's :file.txt and :/message syntax from beeing modified.
+ */
+ if (*it == ':')
+ goto skip_p2w;
+
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
recurse = true;
it = ++*src;