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

From
Junio C Hamano <hidden>
Date
2021-09-27 16:30:46
Jeff King [off-list ref] writes:
quoted
quoted
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"?
Whoops, that should have been "envIs", asserting that $FOO contains
"bar".
Oh, "can we check with a literal with leading whitespace?" was what
my question was about ;-)
As I said, I think it matters more with the infix operators, as:

  [includeIf "env:FOO == bar"]

is more readable than:

  [includeIf "env:FOO==bar"]
Sure, but at that point, we'd probably want some quoting mechanism
for the literal to be compared, e.g.

	[includeIf "env:PATH ~= \"(:|^)/usr/bin(:|$)\""]
But I do think:

  [includeIf "envIs:FOO:bar"]

is harder to read than even:

  [includeIf "envIs:FOO: bar"]
Hmph, that's quite subjective, I am afraid.  When I see the latter
in the configuration file, "do I have to have a single space before
'bar' in the value of $FOO" would be the first question that would
come to my mind.

With an understanding that our syntax is so limited that we cannot
even write '=' and need to resort to Is: instead, I'd actually find
that the former less confusing than the latter.

Thanks.
Thread (10 messages) 10 messages, 4 authors, last reply 2021-09-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help