]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mingw: sh arguments need quoting in more circumstances
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 19 Sep 2019 21:43:03 +0000 (23:43 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 6 Dec 2019 15:31:15 +0000 (16:31 +0100)
Previously, we failed to quote characters such as '*', '(' and the
likes. Let's fix this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
compat/mingw.c

index 7635ad5152e4bb5ac4afb726dee6aca80fa86b50..2c55c3426cb7d396fb9edd921805fcc55ac39b2e 100644 (file)
@@ -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;
        }