@matheusbsbs / matheus-bagliano / commits / 7d8b676992
Fork 0

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>

Johannes Schindelin committed Sep 19, 2019 at 23:43 UTC 7d8b676992ba0418aeb78f0ad1f4e193ad979b2e
1 file changed +3 -2
compat/mingw.c
+3 -2
@@ -1120,13 +1120,14 @@ static const char *quote_arg_msys2(const char *arg)
1120
1121 for (p = arg; *p; p++) {
1122 int ws = isspace(*p);
1123 - if (!ws && *p != '\\' && *p != '"' && *p != '{')
1123 + if (!ws && *p != '\\' && *p != '"' && *p != '{' && *p != '\'' &&
1124 + *p != '?' && *p != '*' && *p != '~')
1125 continue;
1126 if (!buf.len)
1127 strbuf_addch(&buf, '"');
1128 if (p != p2)
1129 strbuf_add(&buf, p2, p - p2);
1129 - if (!ws && *p != '{')
1130 + if (*p == '\\' || *p == '"')
1131 strbuf_addch(&buf, '\\');
1132 p2 = p;
1133 }