Re: [PATCH] git-am: add --directory=<dir> option
- From
Stephan Beyer <s-beyer@gmx.net>
- Date
- Jan 15, 2009, 01:08 UTC
- Message-ID
- <20090115010856.GF32313@leksak.fem-net>
- In-Reply-To
- <7vzlhtxvu5.fsf@gitster.siamese.dyndns.org>
Hi,
Junio C Hamano wrote:
Show 14 quoted lines
> > 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 :-)
Show 5 quoted lines
> > 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