From: John Keeping <john@keeping.me.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: John Keeping <john@keeping.me.uk>,
git@vger.kernel.org, Ralf Thielow <ralf.thielow@gmail.com>
Subject: Re: [PATCH v2] rebase -i: respect core.commentchar
Date: Tue, 12 Feb 2013 17:53:22 +0000 [thread overview]
Message-ID: <20130212175322.GC13501@farnsworth.metanate.com> (raw)
In-Reply-To: <7v4nhhigp5.fsf@alter.siamese.dyndns.org>
On Tue, Feb 12, 2013 at 09:29:26AM -0800, Junio C Hamano wrote:
> John Keeping <john@keeping.me.uk> writes:
>
> > ... the following fixup is also needed to avoid relying on the shell
> > emitting a literal backslash when a backslash isn't followed by a known
> > escape character.
> >
> > -- >8 --
> >
> > diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> > index cbe36bf..84bd525 100755
> > --- a/t/t3404-rebase-interactive.sh
> > +++ b/t/t3404-rebase-interactive.sh
> > @@ -947,7 +947,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
> > test_when_finished "git config --unset core.commentchar" &&
> > cat >comment-lines.sh <<EOF &&
> > #!$SHELL_PATH
> > -sed -e "2,\$ s/^/\\\\\\/" "\$1" >"\$1".tmp
> > +sed -e "2,\$ s/^/\\\\\\\\/" "\$1" >"\$1".tmp
> > mv "\$1".tmp "\$1"
> > EOF
> > chmod a+x comment-lines.sh &&
>
> Yeek. If you used write_script with here-text that does not
> interpolate,
>
> write_script remove-all-but-the-first.sh <<\EOF
> sed -e '2,$s/^/\\/' <"$1" >"$1.tmp" &&
> mv "$1.tmp" "$1"
> EOF
>
> the above would be much more readable.
Yet another thing for me to learn about ;-)
Do you mean to use that outside the test case, so that the single quotes
work? Or do I still need some level of escaping?
> I am not sure if I understand what you meant by "literal backslash
> blah blah", though.
It turns out that having this in the script works (in bash and dash
although I haven't checked what Posix has to say about it):
sed -e "2,$ s/^/\\\/"
and is equivalent to:
sed -e '2,$ s/^/\\/'
because backslashes that aren't recognised as part of an escape sequence
are not treated specially.
John
next prev parent reply other threads:[~2013-02-12 17:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-11 19:21 [PATCH] rebase -i: respect core.commentchar John Keeping
2013-02-11 20:17 ` Junio C Hamano
2013-02-11 21:39 ` John Keeping
2013-02-11 21:49 ` Junio C Hamano
2013-02-11 23:08 ` [PATCH v2] " John Keeping
2013-02-12 0:13 ` Junio C Hamano
2013-02-12 9:53 ` John Keeping
2013-02-12 17:29 ` Junio C Hamano
2013-02-12 17:53 ` John Keeping [this message]
2013-02-12 18:21 ` Junio C Hamano
2013-02-12 18:00 ` Junio C Hamano
2013-02-12 18:09 ` John Keeping
2013-02-12 18:23 ` Junio C Hamano
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=20130212175322.GC13501@farnsworth.metanate.com \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ralf.thielow@gmail.com \
/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.