Skip to content

Commit

Permalink
mingw(is_msys2_sh): handle forward slashes in the sh.exe path, too
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dscho committed Jul 11, 2024
1 parent a718183 commit f04cfd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f04cfd9

Please sign in to comment.