Re: [PATCH] blame: Allow to blame paths freshly added to the index
- From
Jeff King <peff@peff.net>
- Date
- Jul 15, 2016, 12:37 UTC
- Message-ID
- <20160715123758.GA22395@sigill.intra.peff.net>
- In-Reply-To
- <20160715123245.rdpbl4tmqscyf2tx@glandium.org>
On Fri, Jul 15, 2016 at 09:32:45PM +0900, Mike Hommey wrote:
Show 19 quoted lines
> > > +test_expect_success 'blame wholesale copy and more in the index' '
> > > +
> > > + {
> > > + echo ABC
> > > + echo DEF
> > > + echo XXXX
> > > + echo YYYY
> > > + echo GHIJK
> > > + } >horse &&
> >
> > A more common way to do this in our test scripts is by using here
> > documents. However, in this case I would suggest
> >
> > test_write_lines ABC DEF XXXX YYYY GHIJK >horse
>
> I merely copied the pattern used in other places in the same test file.
> Using test_write_lines or something else (what are "here documents"?)
> would break consistency. I can also change the other similar blocks at
> the same time, though, whichever you prefer.A here document is this:
cat <<-\EOF ABC DEF XXXX YYYY GHIJK EOF
The "<<" starts the here-doc. The "-" tells the shell to strip leading tabs (so you can keep it indented with the rest of the code. The "\" tells the shell not to interpolate (not a big deal here, but great for more complicated input). The "EOF" tells it where to stop.
Matching surrounding style is always reasonable, though I do think this particular file is a bit of an oddball. Most of our scripts use here documents. Either is OK in this case, IMHO.
Personally I do not find test_write_lines particularly readable, but I guess some people do, which is why it exists.
-Peff