---- snip ----

Thanks to Hannes for pointing out the actual mechanism even though
I'd rather blame CreateProcess().

---- snap ----
Work around misfeature in msys/cygwin globbing whereby single
element bracketed lists get "expanded", resulting in the brackets
getting stripped out.  The workaround is to simply quote all arguments
which contain a '{'.

For reasons I don't understand this quoting does _not_ break
comma-separated lists - they still get expanded correctly.
Perhaps /bin/sh handles those cases?

Regardless this commit fixes "git stash apply [EMAIL PROTECTED]", which
previously got expanded to the meaningless value of "[EMAIL PROTECTED]".

Note that "git-stash apply [EMAIL PROTECTED]" works even without this patch
(presumably because it is executed directly by /bin/sh).

Note also that git-stash still has a bug whereby it doesn't validate
its final argument (i.e. the "[EMAIL PROTECTED]" mentioned above).
This commit does nothing to fix that problem.

Signed-off-by: Eric Raible <[EMAIL PROTECTED]>
---
 compat/mingw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index a5b43bc..95ba563 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -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++;
--
1.5.5.1015.g9d258.dirty

Reply via email to