Thread (7 messages) flat view 7 messages, 3 authors, 2016-07-15

Re: [PATCH] blame: Allow to blame paths freshly added to the index

From: Jeff King <hidden>
Date: 2016-07-15 12:38:07

On Fri, Jul 15, 2016 at 09:32:45PM +0900, Mike Hommey wrote:
quoted
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help