Some remote systems can employ restricted shells that aren't very smart
with quotes, so avoid quoting when it's not strictly necessary.
The list of "safe" characters comes from Mercurial's shell quoting
function used for its ssh client side. There likely are more that could
be added to the list.
Signed-off-by: Mike Hommey <redacted>
---
connect.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/connect.c b/connect.c
index 96c8c1d..919bf9e 100644
--- a/connect.c
+++ b/connect.c
@@ -668,6 +668,17 @@ static void prepare_connect_command(struct strbuf *cmd, const char *prog,
strbuf_addstr(cmd, prog);
strbuf_addch(cmd, ' ');
}
+ if (quote) {
+ const char *p;
+ for (p = path; *p; p++) {
+ if (!isalnum(*p) && *p != '@' && *p != '%' &&
+ *p != '_' && *p != '+' && *p != '=' && *p != ':' &&
+ *p != ',' && *p != '.' && *p != '/' && *p != '-')
+ break;
+ }
+ if (!*p)
+ quote = 0;
+ }
if (quote)
sq_quote_buf(cmd, path);
else--
2.8.1.5.g18c8a48