]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mingw(is_msys2_sh): handle forward slashes in the `sh.exe` path, too
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 13 Jul 2024 21:08:21 +0000 (21:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 13 Jul 2024 23:23:37 +0000 (16:23 -0700)
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>
compat/mingw.c

index 6097b8f9e60e12c8c3f81ae986290acf1d5f7be7..29d3f09768c29a4aab37da49761ec7f3d3813e96 100644 (file)
@@ -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)