summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-09-19 21:43:03 (GMT)
committerJohannes Schindelin <johannes.schindelin@gmx.de>2019-12-06 15:31:15 (GMT)
commit7d8b676992ba0418aeb78f0ad1f4e193ad979b2e (patch)
tree6e33254247856365eeba59cbaa65a9523f75db54 /compat
parent04522edbd4086cd9063a8e65664c11a87bb7d89e (diff)
downloadgit-7d8b676992ba0418aeb78f0ad1f4e193ad979b2e.zip
git-7d8b676992ba0418aeb78f0ad1f4e193ad979b2e.tar.gz
git-7d8b676992ba0418aeb78f0ad1f4e193ad979b2e.tar.bz2
mingw: sh arguments need quoting in more circumstances
Previously, we failed to quote characters such as '*', '(' and the likes. Let's fix this. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 7635ad5..2c55c34 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1120,13 +1120,14 @@ static const char *quote_arg_msys2(const char *arg)
for (p = arg; *p; p++) {
int ws = isspace(*p);
- if (!ws && *p != '\\' && *p != '"' && *p != '{')
+ if (!ws && *p != '\\' && *p != '"' && *p != '{' && *p != '\'' &&
+ *p != '?' && *p != '*' && *p != '~')
continue;
if (!buf.len)
strbuf_addch(&buf, '"');
if (p != p2)
strbuf_add(&buf, p2, p - p2);
- if (!ws && *p != '{')
+ if (*p == '\\' || *p == '"')
strbuf_addch(&buf, '\\');
p2 = p;
}