Re: [PATCH] config: add an includeIf.env{Exists,Bool,Is,Match}
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 28, 2021, 00:24 UTC
- Message-ID
- <xmqqee99mtsk.fsf@gitster.g>
- In-Reply-To
- <YVImeFHxY7hmb3wY@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
>> 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(:|$)\""] > > Ick. The extra quoting of the internal double-quotes is pretty horrid to > look at. Also, how does one match a double-quote in the value? \\\"?
Ick indeed. I didn't mean to say you must always dq quote. It started more like
includeIf "env:VAR == ' value with leading whitespace'"
(or use \" inside ""-pair to mean a double-quote) as a demonstration of an escape hatch needed if we took your "let's by default strip the whitespace around the value" example in the message I was responding to.
Just like we in most cases do not have to quote the value in the configuration files, unless you have strange needs like wanting to express a value with leading whitespace that should not be stripped, if we were to go this route,
> If it were optional, that would make the common cases easy (no dq, no > whitespace), and the hard ones possible.
Yup.