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

Re: [PATCH] config: add an includeIf.env{Exists,Bool,Is,Match}

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 24, 2021, 21:28 UTC
Message-ID
<xmqqa6k1slxe.fsf@gitster.g>
In-Reply-To
<YU49+Y+nRhl1mgof@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> I had thought to extend with the operator, like:
>
>   # equality
>   [includeIf "env:FOO==value"]
>   # regex
>   [includeIf "env:FOO=~v[a]l"]
Yup, that matched my aesthetics better ;-)
> But as you note, "=" is somewhat problematic, and without that we can't
> use the "usual" operators. Plus there's no usual operator for globbing. ;)
> So embedding it in the name is fine by me (and mostly a bikeshed thing
> anyway).

Perhaps. I am not sure if we deeply care about "git -c var=val" in this case, especially since this is part of includeif, though. It may be more important to keep the syntax useful and extensible for everyday use than for one-off "git -c" testing.

> I agree we don't really need a "/i" variant here.

Case insensitive environment variable names, no, but case insensitive matching of values, maybe? But I'd be happy to see us start very minimally (even just envEQ alone without any other frills, or optionally envNE to negate it, would be fine by me).

Show 6 quoted lines
> Should we allow whitespace around key names and values? E.g.:
>
>   [includeIf "env: FOO: bar"]
>
> is IMHO more readable (even more so if we had infix operators like
> "==").
This asserts what? FOO=" bar"?
Previous: Jeff KingNext: Jeff King
Message 8 of 23 in “ANSI sequences produced on non-ANSI terminal”
  1. The Grey WolfSep 23, 2021
  2. Jeff KingSep 23, 2021
  3. Junio C HamanoSep 23, 2021
  4. Randall S. BeckerSep 23, 2021
  5. Kevin DaudtSep 25, 2021
  6. config: add an includeIf.env{Exists,Bool,Is,Match}Ævar Arnfjörð Bjarmason, Sep 24, 2021
  7. Jeff KingSep 24, 2021
  8. Junio C HamanoSep 24, 2021
  9. Jeff KingSep 24, 2021
  10. Junio C HamanoSep 27, 2021
  11. Jeff KingSep 27, 2021
  12. Randall S. BeckerSep 27, 2021
  13. Jeff KingSep 27, 2021
  14. Randall S. BeckerSep 27, 2021
  15. Ævar Arnfjörð BjarmasonSep 27, 2021
  16. Jeff KingSep 28, 2021
  17. Ævar Arnfjörð BjarmasonSep 28, 2021
  18. Jeff KingSep 28, 2021
  19. Ævar Arnfjörð BjarmasonSep 28, 2021
  20. Junio C HamanoSep 28, 2021
  21. GreywolfSep 24, 2021
  22. Jeff KingSep 25, 2021
  23. GreywolfOct 1, 2021

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.