git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Beyer <s-beyer@gmx.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>,
	Simon 'corecode' Schubert <corecode@fs.ei.tum.de>,
	Kevin Ballard <kevin@sb.org>
Subject: Re: [PATCH] git-am: add --directory=<dir> option
Date: Thu, 15 Jan 2009 02:08:56 +0100	[thread overview]
Message-ID: <20090115010856.GF32313@leksak.fem-net> (raw)
In-Reply-To: <7vzlhtxvu5.fsf@gitster.siamese.dyndns.org>

Hi,

Junio C Hamano wrote:
> > Do I have a thinko or should it be this:
> >
> > +		sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
> > 		                   ^^
> > 			(added for escaping ' outside single quotes)
> 
> Almost.
> 
> Certainly my original was bad; shell unquotes to "s/'/'\''/g", but that
> backslash is not protected from further interpretation by sed, which
> happily turns backslash-single quote into a single quote, which I forgot.
> 
> You feed "s/'/'\\\''/g" which correctly protects one backslash from sed by
> doubling it, but it has one unnecessary extra backslash.

My attempt was to escape one backslash and to escape one single quote.

> The extra one
> does not hurt because the backslash + single quote is eaten by sed to
> produce a single quote, but it is not quite right.

Well, this explains why my syntax highlighting has "gone mad" in your
former and in my version.

> We should be feeding sed with "s/'/'\\''/g", so you need to add one
> backslash to mine.

Ok, works like a charm :-)

> > Have you forgotten to add the files prefixed with "am-test-5-" or is this
> > patch based on another one?
> 
> The one I actually queued is b47dfe9 (git-am: add --directory=<dir>
> option, 2009-01-11) and it does include these test vectors.  My bad.

Ohh, I did not even notice that you queued it, because I do not track "next".

And in my git-am.txt snippet I even forgot adding the option to the synopsis.
Oh, boy. :-)

I think it's fine now. :-)

Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

      reply	other threads:[~2009-01-15  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12  6:33 [PATCH] git-am: add --directory=<dir> option Junio C Hamano
2009-01-14 23:46 ` Stephan Beyer
2009-01-15  0:21   ` Junio C Hamano
2009-01-15  1:08     ` Stephan Beyer [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=20090115010856.GF32313@leksak.fem-net \
    --to=s-beyer@gmx.net \
    --cc=corecode@fs.ei.tum.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kevin@sb.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 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).