On Thu, Apr 28, 2016 at 7:12 AM, Mike Hommey <mh@xxxxxxxxxxxx> wrote: > 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. > Would it make sense to move the new code into its own function and document it with this paragraph of the commit message, i.e. hinting at Mercurial safe characters or others? > Signed-off-by: Mike Hommey <mh@xxxxxxxxxxxx> > --- > 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 > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html