summaryrefslogtreecommitdiffstats
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2024-07-13 23:08:21 +0200
committerJunio C Hamano <gitster@pobox.com>2024-07-14 01:23:37 +0200
commitf1ed769a3bc045d9f79396fb6074bfb33b83e09d (patch)
treeb54ce96cc35a1eb41795e58d2275baa1c19043c3 /compat/mingw.c
parentwin32: override `fspathcmp()` with a directory separator-aware version (diff)
downloadgit-f1ed769a3bc045d9f79396fb6074bfb33b83e09d.tar.xz
git-f1ed769a3bc045d9f79396fb6074bfb33b83e09d.zip
mingw(is_msys2_sh): handle forward slashes in the `sh.exe` path, too
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 6097b8f9e6..29d3f09768 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)