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

Re: [PATCH v4 3/4] t1300: add more tests for whitespace and inline comments

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 21, 2024, 04:55 UTC
Message-ID
<CAPig+cQekOLrpcK_NcL951SRZAg-1Y1aFzE0-i-uCTK_XuiajQ@mail.gmail.com>
In-Reply-To
<688128d8ef09589712634888074ffd71a192a7aa.1710994548.git.dsimic@manjaro.org>
On Thu, Mar 21, 2024 at 12:17 AM Dragan Simic <dsimic@manjaro.org> wrote:
Show 19 quoted lines
> Add a handful of additional tests, to improve the coverage of the handling
> of configuration file entries whose values contain internal whitespace,
> leading and/or trailing whitespace, which may or may not be enclosed within
> quotation marks, or which contain an additional inline comment.
>
> At the same time, rework one already existing whitespace-related test a bit,
> to ensure its consistency with the newly added tests.  This change introduced
> no functional changes to the already existing test.
>
> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
> Helped-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Dragan Simic <dsimic@manjaro.org>
> ---
> diff --git a/t/t1300-config.sh b/t/t1300-config.sh
> @@ -11,6 +11,98 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> +test_expect_success 'setup whitespace config' '
> +       sed -e "s/^|//" \
> +           -e "s/[$]$//" \
> +           -e "s/X/\\t/g" >.git/config <<-\EOF

Representing TAB as `\t` in the sed replacement is not necessarily portable and (as far as I can see) we don't rely upon that in any existing tests. It probably would be safer to employ a literal TAB character in `s/X/ /g` as Junio showed in his example[1].

[1]: https://lore.kernel.org/git/xmqqzfutjtfo.fsf@gitster.g/
Previous: Dragan SimicNext: Dragan Simic
Message 5 of 14 in “Fix a bug in configuration parsing, and improve tests and documentation”
  1. 0/4 Fix a bug in configuration parsing, and improve tests and documentationDragan Simic, Mar 21, 2024
  2. 1/4 config: minor addition of whitespaceDragan Simic, Mar 21, 2024
  3. 2/4 config: really keep value-internal whitespace verbatimDragan Simic, Mar 21, 2024
  4. 3/4 t1300: add more tests for whitespace and inline commentsDragan Simic, Mar 21, 2024
  5. Eric SunshineMar 21, 2024
  6. Dragan SimicMar 21, 2024
  7. 4/4 config.txt: describe handling of whitespace furtherDragan Simic, Mar 21, 2024
  8. Eric SunshineMar 21, 2024
  9. Dragan SimicMar 21, 2024
  10. Eric SunshineMar 21, 2024
  11. Dragan SimicMar 21, 2024
  12. Junio C HamanoMar 21, 2024
  13. Eric SunshineMar 21, 2024
  14. Dragan SimicMar 21, 2024

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.