git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] t7503: use write_script to generate hook scripts

From
Jeff King <peff@peff.net>
Date
Nov 26, 2014, 19:03 UTC
Message-ID
<20141126190315.GB1734@peff.net>
In-Reply-To
<xmqqk32hrfuv.fsf@gitster.dls.corp.google.com>
On Wed, Nov 26, 2014 at 10:12:08AM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> >> +write_script "$HOOK" <<EOF
> >
> > While you are touching this line, please make it "<<\EOF". It does not
> > matter for these simple cases, but as a style, we try to avoid
> > interpolation unless it is necessary.
> 
> Thanks.  It is more about reducing cognitive burden from the
> readers.  An unquoted <<EOF signals you that your eyes need to scan
> carefully for $subsitutions to understand what is going on, instead
> of coasting it over.

While we are talking about it, do we have a style preference on always/never using "<<-" unless necessary? I do not think it is as important as preventing interpolation, because it does not introduce a cognitive load in the same way. But consistently using "<<-" is one less thing for shell newbies to be confused by, and to get wrong when cargo-culting.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 13 in “pre-commit hook updates”
  1. 0/2 pre-commit hook updatesØystein Walle, Nov 25, 2014
  2. 1/2 t7503: use write_script to generate hook scriptsØystein Walle, Nov 25, 2014
  3. Eric SunshineNov 26, 2014
  4. Jeff KingNov 26, 2014
  5. Junio C HamanoNov 26, 2014
  6. Jeff KingNov 26, 2014
  7. Junio C HamanoNov 26, 2014
  8. 2/2 commit: inform pre-commit that --amend was usedØystein Walle, Nov 25, 2014
  9. Eric SunshineNov 26, 2014
  10. Eric SunshineNov 26, 2014
  11. Jeff KingNov 26, 2014
  12. Junio C HamanoNov 26, 2014
  13. Jeff KingNov 26, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.