From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] rev-parse: add --sq-quote to shell quote arguments
Date: Sat, 25 Apr 2009 06:57:43 +0200 [thread overview]
Message-ID: <200904250657.43344.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7v8wlqii2y.fsf@gitster.siamese.dyndns.org>
Le vendredi 24 avril 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > @@ -30,6 +30,9 @@ OPTIONS
> > Only meaningful in `--parseopt` mode. Tells the option parser to echo
> > out the first `--` met instead of skipping it.
> >
> > +--sq-quote::
> > + Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE section
> > below). +
>
> Hmph, I wonder how this interacts with the existing --sq option to the
> same command in the mental model of end users.
I just sent a new version where difference between --sq and --sq-quote are
discussed.
> > +Example
> > +~~~~~~~
> > +
> > +------------
> > +$ git rev-parse --sq-quote "'''" '"""' "arg with space"
> > + ''\'''\'''\''' '"""' 'arg with space'
> > +------------
>
> Yuck --- does asciidoc formats this correctly?
>
> ... goes and tries ...
>
> Not very readable. A better example might be to demonstrate something
> like this:
>
> $ cat >your-git-script.sh <<\EOF
> #!/bin/sh
> # quote user-supplied arguments
> args=$(git rev-parse --sq-quote "$@")
> # and use it inside a handcrafted command line
> command="git frotz -n24 $args"
> eval "$command"
> EOF
>
> $ sh your-git-script.sh "a b'c"
>
> i.e, put stress on how to use it, not on how it works internally.
I agree your example is better. I used it in the v2 I just sent.
Thanks,
Christian.
prev parent reply other threads:[~2009-04-25 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 6:28 [PATCH 1/3] rev-parse: add --sq-quote to shell quote arguments Christian Couder
2009-04-24 8:14 ` Junio C Hamano
2009-04-24 8:33 ` Johannes Sixt
2009-04-25 5:06 ` Christian Couder
2009-04-25 4:57 ` Christian Couder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904250657.43344.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).