Re: [PATCH 1/3] rev-parse: add --sq-quote to shell quote arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le vendredi 24 avril 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@xxxxxxxxxxxxx> 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.
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]