Skip to content

Commit 7d8b676

Browse files
committed
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 <[email protected]>
1 parent 04522ed commit 7d8b676

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compat/mingw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,13 +1120,14 @@ static const char *quote_arg_msys2(const char *arg)
11201120

11211121
for (p = arg; *p; p++) {
11221122
int ws = isspace(*p);
1123-
if (!ws && *p != '\\' && *p != '"' && *p != '{')
1123+
if (!ws && *p != '\\' && *p != '"' && *p != '{' && *p != '\'' &&
1124+
*p != '?' && *p != '*' && *p != '~')
11241125
continue;
11251126
if (!buf.len)
11261127
strbuf_addch(&buf, '"');
11271128
if (p != p2)
11281129
strbuf_add(&buf, p2, p - p2);
1129-
if (!ws && *p != '{')
1130+
if (*p == '\\' || *p == '"')
11301131
strbuf_addch(&buf, '\\');
11311132
p2 = p;
11321133
}

0 commit comments

Comments
 (0)