Re: [PATCHv2 0/3] Make diff plumbing commands respect the indentHeuristic.
- From
Jeff King <peff@peff.net>
- Date
- May 1, 2017, 05:15 UTC
- Message-ID
- <20170501051528.tpw3zlcpercdwdln@sigill.intra.peff.net>
- In-Reply-To
- <xmqqlgqhjs8b.fsf@gitster.mtv.corp.google.com>
On Sun, Apr 30, 2017 at 06:11:48PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes: > > > diff --git a/t/t4051-diff-function-context.sh b/t/t4051-diff-function-context.sh > > index 6154acb45..5f46c0341 100755 > > --- a/t/t4051-diff-function-context.sh > > +++ b/t/t4051-diff-function-context.sh > > @@ -72,7 +72,7 @@ test_expect_success 'setup' ' > > > > # overlap function context of 1st change and -u context of 2nd change > > grep -v "delete me from hello" <"$dir/hello.c" >file.c && > > - sed 2p <"$dir/dummy.c" >>file.c && > > + sed "2aextra line" <"$dir/dummy.c" >>file.c && > > I've never used 'a' (or 'i') command of sed without having it > immediately followed by a backslash-newline in my scripts. How > portable is this addition, I have to wonder. Can BSD folks give it > a quick test?
I think you're right that it needs the backslash. It's so rarely used that I always forget which one is the portable way.
-Peff
PS Outside of our test scripts, I'd probably just have written:
perl -lpe 'print "extra line" if $. == 2'
I think we have traditionally preferred sed/awk to perl, but given the heavy use of vanilla perl elsewhere in the test suite, I think that is maybe just superstition at this point.