summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-09-19 15:05:21 (GMT)
committerJohannes Schindelin <johannes.schindelin@gmx.de>2019-12-06 15:31:14 (GMT)
commite2ba3d6f6d1c2b0e7e501ae01a0e839a6f537188 (patch)
tree3925c8d476e5acdc12be20bd06ae0b330714c360 /compat
parentd9061ed9dacb5657bcff4260fc35a831946907ec (diff)
downloadgit-e2ba3d6f6d1c2b0e7e501ae01a0e839a6f537188.zip
git-e2ba3d6f6d1c2b0e7e501ae01a0e839a6f537188.tar.gz
git-e2ba3d6f6d1c2b0e7e501ae01a0e839a6f537188.tar.bz2
mingw: detect when MSYS2's sh is to be spawned more robustly
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 0e14cab..5dbaae9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1391,7 +1391,10 @@ static inline int match_last_path_component(const char *path, size_t *len,
static int is_msys2_sh(const char *cmd)
{
- if (cmd && !strcmp(cmd, "sh")) {
+ if (!cmd)
+ return 0;
+
+ if (!strcmp(cmd, "sh")) {
static int ret = -1;
char *p;
@@ -1411,6 +1414,16 @@ static int is_msys2_sh(const char *cmd)
}
return ret;
}
+
+ if (ends_with(cmd, "\\sh.exe")) {
+ static char *sh;
+
+ if (!sh)
+ sh = path_lookup("sh", 0);
+
+ return !fspathcmp(cmd, sh);
+ }
+
return 0;
}