All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] rev-parse: add --sq-quote to shell quote arguments
Date: Fri, 24 Apr 2009 01:14:45 -0700	[thread overview]
Message-ID: <7v8wlqii2y.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090424062902.3705.44704.chriscool@tuxfamily.org> (Christian Couder's message of "Fri, 24 Apr 2009 08:28:59 +0200")

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.

> +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.

  reply	other threads:[~2009-04-24  8:16 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 [this message]
2009-04-24  8:33   ` Johannes Sixt
2009-04-25  5:06     ` Christian Couder
2009-04-25  4:57   ` Christian Couder

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=7v8wlqii2y.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.