diff --git a/compat/mingw.c b/compat/mingw.c index 0b86861a96..50f3429c85 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1134,13 +1134,13 @@ static const char *quote_arg_msys2(const char *arg) for (p = arg; *p; p++) { int ws = isspace(*p); - if (!ws && *p != '\\' && *p != '"') + if (!ws && *p != '\\' && *p != '"' && *p != '{') continue; if (!buf.len) strbuf_addch(&buf, '"'); if (p != p2) strbuf_add(&buf, p2, p - p2); - if (!ws) + if (!ws && *p != '{') strbuf_addch(&buf, '\\'); p2 = p; } diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh index 3063bb76f5..3b6e3af094 100755 --- a/t/t0061-run-command.sh +++ b/t/t0061-run-command.sh @@ -182,4 +182,14 @@ test_expect_success 'GIT_TRACE with environment variables' ' ) ' +test_expect_success MINGW 'verify curlies are quoted properly' ' + : force the rev-parse through the MSYS2 Bash && + git -c alias.r="!git rev-parse" r -- a{b}c >actual && + cat >expect <<-\EOF && + -- + a{b}c + EOF + test_cmp expect actual +' + test_done