mirror of
https://github.com/git/git.git
synced 2026-01-23 00:47:02 +00:00
squash! mingw: special-case arguments to sh
We need to take care to quote not only whitespace, but also curly
brackets. As aliases frequently going through the MSYS2 Bash, and
as aliases frequently get parameters such as HEAD@{yesterday}, let's
make sure that this does not regress by adding a test case for that.
Helped-by: Kim Gybels <kgybels@infogroep.be>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user