From: Christian Couder <chriscool@tuxfamily.org>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/3] rev-parse: add --sq-quote to shell quote arguments
Date: Sat, 25 Apr 2009 07:06:40 +0200 [thread overview]
Message-ID: <200904250706.40533.chriscool@tuxfamily.org> (raw)
In-Reply-To: <49F17945.8000004@viscovery.net>
Le vendredi 24 avril 2009, Johannes Sixt a écrit :
> Junio C Hamano schrieb:
> > 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.
>
> Hmm, that makes me wonder why we special-case shell-quoting and implement
> it in an executable. Why don't we have perl-quoting, C-quoting,
> PHP-quoting, $language-of-your-choice quoting, etc, too?
Because there are a lot of shell scripts in the Git source code and it's an
important problem for shell scripts to properly handle arguments.
> I think we should simply move sq() from git-am to git-sh-setup and use
> that in git-bisect.
We already have an implementation of shell quoting in C, why not use it
everywhere instead of having 2 implementations?
And what happens if someone want to port to C a shell script that uses sq()?
The implementation used will have to be the one in C, so why not use it
right now?
Regards,
Christian.
next prev parent reply other threads:[~2009-04-25 5:09 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 [this message]
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=200904250706.40533.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
/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).