mingw: Quote '{}' to work around an error in MSYS' glob()

MSYS expands '{}' in paths even if the pattern between the
braces does not contain a comma. See
http://article.gmane.org/gmane.comp.version-control.msysgit/2341
for a detailed discussion.

This commit fixes (at least) the case of "git stash apply stash@{1}".
Note that "git-stash apply stash@{1}" works even without this patch
(because it is executed directly by /bin/sh).

Note that git-stash still has a bug whereby it doesn't validate
its final argument ("stash@{1}" in this case).  This commit does
nothing to fix that problem.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commit is contained in:
raible
2008-06-08 09:51:32 +02:00
committed by Steffen Prohaska
parent f01c16a4bb
commit b1013825f9

View File

@@ -380,7 +380,7 @@ static const char *quote_arg(const char *arg)
const char *p = arg;
if (!*p) force_quotes = 1;
while (*p) {
if (isspace(*p) || *p == '*' || *p == '?')
if (isspace(*p) || *p == '*' || *p == '?' || *p == '{')
force_quotes = 1;
else if (*p == '"')
n++;