]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mingw: fix quoting of empty arguments for `sh`
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 19 Sep 2019 21:38:33 +0000 (23:38 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 6 Dec 2019 15:31:14 +0000 (16:31 +0100)
When constructing command-lines to spawn processes, it is an unfortunate
but necessary decision to quote arguments differently: MSYS2 has
different dequoting rules (inherited from Cygwin) than the rest of
Windows.

To accommodate that, Git's Windows compatibility layer has two separate
quoting helpers, one for MSYS2 (which it uses exclusively when spawning
`sh`) and the other for regular Windows executables.

The MSYS2 one had an unfortunate bug where a `,` somehow slipped in,
instead of the `;`. As a consequence, empty arguments would not be
enclosed in a pair of double quotes, but the closing double quote was
skipped.

Let's fix this.

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

index 32fc02e36053a5381962d2ef34c7e96a28ff1317..7635ad5152e4bb5ac4afb726dee6aca80fa86b50 100644 (file)
@@ -1136,7 +1136,7 @@ static const char *quote_arg_msys2(const char *arg)
        else if (!buf.len)
                return arg;
        else
-               strbuf_add(&buf, p2, p - p2),
+               strbuf_add(&buf, p2, p - p2);
 
        strbuf_addch(&buf, '"');
        return strbuf_detach(&buf, 0);