git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Phillip Wood <phillip.wood123@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v2 4/7] mingw(is_msys2_sh): handle forward slashes in the `sh.exe` path, too
Date: Thu, 11 Jul 2024 23:11:33 +0000	[thread overview]
Message-ID: <f04cfd91bd9a3a462294ea9125e72b3e6bb64865.1720739496.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1760.v2.git.1720739496.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Whether the full path to the MSYS2 Bash is specified using backslashes
or forward slashes, in either case the command-line arguments need to be
quoted in the MSYS2-specific manner instead of using regular Win32
command-line quoting rules.

In preparation for `prepare_shell_cmd()` to use the full path to
`sh.exe` (with forward slashes for consistency), let's teach the
`is_msys2_sh()` function about this; Otherwise 5580.4 'clone with
backslashed path' would fail once `prepare_shell_cmd()` uses the full
path instead of merely `sh`.

This patch relies on the just-introduced fix where `fspathcmp()` handles
backslashes and forward slashes as equivalent on Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 6097b8f9e60..29d3f09768c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1546,7 +1546,7 @@ static int is_msys2_sh(const char *cmd)
 		return ret;
 	}
 
-	if (ends_with(cmd, "\\sh.exe")) {
+	if (ends_with(cmd, "\\sh.exe") || ends_with(cmd, "/sh.exe")) {
 		static char *sh;
 
 		if (!sh)
-- 
gitgitgadget


  parent reply	other threads:[~2024-07-11 23:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 13:02 [PATCH] var(win32): do report the GIT_SHELL_PATH that is actually used Johannes Schindelin via GitGitGadget
2024-07-08 18:54 ` Junio C Hamano
2024-07-08 23:40   ` brian m. carlson
2024-07-08 23:55     ` Junio C Hamano
2024-07-09  0:25       ` brian m. carlson
2024-07-09 16:31         ` Junio C Hamano
2024-07-09 13:53     ` Phillip Wood
2024-07-08 19:03 ` Junio C Hamano
2024-07-09  8:55 ` Phillip Wood
2024-07-11 12:03   ` Johannes Schindelin
2024-07-17 14:55     ` phillip.wood123
2024-07-11 23:11 ` [PATCH v2 0/7] " Johannes Schindelin via GitGitGadget
2024-07-11 23:11   ` [PATCH v2 1/7] run-command: refactor getting the Unix shell path into its own function Johannes Schindelin via GitGitGadget
2024-07-11 23:11   ` [PATCH v2 2/7] strvec: declare the `strvec_push_nodup()` function globally Johannes Schindelin via GitGitGadget
2024-07-11 23:11   ` [PATCH v2 3/7] win32: override `fspathcmp()` with a directory separator-aware version Johannes Schindelin via GitGitGadget
2024-07-12 13:46     ` Phillip Wood
2024-07-11 23:11   ` Johannes Schindelin via GitGitGadget [this message]
2024-07-12 13:49     ` [PATCH v2 4/7] mingw(is_msys2_sh): handle forward slashes in the `sh.exe` path, too Phillip Wood
2024-07-11 23:11   ` [PATCH v2 5/7] run-command(win32): resolve the path to the Unix shell early Johannes Schindelin via GitGitGadget
2024-07-11 23:11   ` [PATCH v2 6/7] run-command: declare the `git_shell_path()` function globally Johannes Schindelin via GitGitGadget
2024-07-11 23:11   ` [PATCH v2 7/7] var(win32): do report the GIT_SHELL_PATH that is actually used Johannes Schindelin via GitGitGadget
2024-07-12 15:35     ` Junio C Hamano
2024-07-12 13:51   ` [PATCH v2 0/7] " Phillip Wood
2024-07-12 22:16     ` Junio C Hamano
2024-07-13 21:08   ` [PATCH v3 " Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 1/7] run-command: refactor getting the Unix shell path into its own function Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 2/7] strvec: declare the `strvec_push_nodup()` function globally Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 3/7] win32: override `fspathcmp()` with a directory separator-aware version Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 4/7] mingw(is_msys2_sh): handle forward slashes in the `sh.exe` path, too Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 5/7] run-command(win32): resolve the path to the Unix shell early Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 6/7] run-command: declare the `git_shell_path()` function globally Johannes Schindelin via GitGitGadget
2024-07-13 21:08     ` [PATCH v3 7/7] var(win32): do report the GIT_SHELL_PATH that is actually used Johannes Schindelin via GitGitGadget
2024-07-17 14:51     ` [PATCH v3 0/7] " Phillip Wood
2024-07-17 22:47     ` brian m. carlson
2024-07-17 22:51       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f04cfd91bd9a3a462294ea9125e72b3e6bb64865.1720739496.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood123@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).