Web lists-archives.com

Re: git silently ignores include directive with single quotes

Jeff King <peff@xxxxxxxx> writes:

> On Sat, Sep 08, 2018 at 11:58:47AM -0700, Stas Bekman wrote:
>> This doesn’t:
>> [include]
>>         path = '../.gitconfig'
> So I think it's been covered elsewhere that single quotes aren't a thing
> in git's config format. I will say that this was actually a minor
> surprise to me, after a decade of working with the format. ;)
> I don't know if it's worth changing now or not It would be
> backwards-incompatible, but I wonder if we could do it in a sane way.
> E.g., with a rule like:
>   - if the first non-whitespace character of the value is a
>     single-quote, assume the value is quoted and apply normal shell
>     rules (i.e., no backslash escapes until the ending single-quote)
>   - otherwise, single-quotes are not special at all

At least the rule would not force those with ' in the middle of
their family names to surround the user.name with extra double
quotes, and it would probably be a good and safe practical solution.
Being safe "by magic" tend to become hard to explain, but in this
case the magic part is probably still simple enough.