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

Re: [PATCH v12 1/5] t0040-test-parse-options.sh: fix style issues

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Apr 5, 2016, 05:08 UTC
Message-ID
<CAFZEwPPPf3OUb8rL-juL3dMXZamwsTO2e+pLg3y8grdJf6W6YA@mail.gmail.com>
In-Reply-To
<CAPig+cQw=aG0NOgEsmdTGc7v3iBA-qG9_C4EdSm=6PcE6Qn-uQ@mail.gmail.com>
On Mon, Apr 4, 2016 at 11:00 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 35 quoted lines
> On Mon, Apr 4, 2016 at 8:45 AM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
>> Okay I will do the change. I was previously unaware about the use of
>> '\' before EOF. I googled it now. But I am still confused about its
>> use in this scenario. Upto what I understood, it is used where you
>> want to expand a variable, substitute a command, arithmethic
>> expansion. The use of '\' in the tests I have changed in v12 wrt 11 is
>> understood by me as you want to remove the use of escape sequences
>> which is justified. But this seems a bit vague. Is it some convention
>> in git?
>
> Both 'EOF' and \EOF suppress interpolation and other transformations
> in the heredoc content which would otherwise occur with plain EOF. The
> 'EOF' form is well documented; \EOF not so much, but is used heavily
> in git test scripts. So:
>
>     x=flormp
>     echo <<EOF
>     Hello, $x
>     EOF
>
> prints "Hello, flormp", whereas:
>
>     echo <<\EOF
>     Hello, $x
>     EOF
>
> prints "Hello, $x".
>
> While test scripts sometimes use \EOF to explicitly suppress variable
> expansion, it's also quite common to use it even when there is nothing
> which could be expanded in the heredoc content, in which case it
> signals to the reader that the author doesn't expect the content to
> undergo expansion or interpolation. It's also a bit of future-proofing
> in case some later change to the heredoc content inserts something
> which might otherwise be expanded.

Thanks for taking out your time to explain this clearly. I will do the changes in the tests as suggested by your review. :)

Previous: Eric SunshineNext: Pranit Bauva
Message 22 of 36 in “t0040-test-parse-options.sh: fix style issues”
  1. 1/5 t0040-test-parse-options.sh: fix style issuesPranit Bauva, Apr 2, 2016
  2. 3/5 parse-options.c: make OPTION_COUNTUP respect "unspecified" valuesPranit Bauva, Apr 2, 2016
  3. Eric SunshineApr 3, 2016
  4. Pranit BauvaApr 5, 2016
  5. 2/5 test-parse-options: print quiet as integerPranit Bauva, Apr 2, 2016
  6. Eric SunshineApr 3, 2016
  7. Pranit BauvaApr 5, 2016
  8. Eric SunshineApr 6, 2016
  9. Duy NguyenApr 8, 2016
  10. Junio C HamanoApr 8, 2016
  11. 4/5 t7507-commit-verbose: improve test coverage by testing number of diffsPranit Bauva, Apr 2, 2016
  12. Eric SunshineApr 4, 2016
  13. Eric SunshineApr 4, 2016
  14. Pranit BauvaApr 5, 2016
  15. 5/5 commit: add a commit.verbose config variablePranit Bauva, Apr 2, 2016
  16. Eric SunshineApr 4, 2016
  17. Eric SunshineApr 4, 2016
  18. Pranit BauvaApr 5, 2016
  19. Eric SunshineApr 3, 2016
  20. Pranit BauvaApr 4, 2016
  21. Eric SunshineApr 4, 2016
  22. Pranit BauvaApr 5, 2016
  23. 1/6 t0040-test-parse-options.sh: fix style issuesPranit Bauva, Apr 9, 2016
  24. 6/6 commit: add a commit.verbose config variablePranit Bauva, Apr 9, 2016
  25. Junio C HamanoApr 12, 2016
  26. Pranit BauvaApr 12, 2016
  27. Junio C HamanoApr 12, 2016
  28. Junio C HamanoApr 12, 2016
  29. Pranit BauvaApr 12, 2016
  30. 5/6 t7507-commit-verbose: improve test coverage by testing number of diffsPranit Bauva, Apr 9, 2016
  31. 2/6 test-parse-options: print quiet as integerPranit Bauva, Apr 9, 2016
  32. Junio C HamanoApr 12, 2016
  33. Pranit BauvaApr 12, 2016
  34. Junio C HamanoApr 12, 2016
  35. 3/6 t0040-parse-options: improve test coveragePranit Bauva, Apr 9, 2016
  36. 4/6 parse-options.c: make OPTION_COUNTUP respect "unspecified" valuesPranit Bauva, Apr 9, 2016

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.