Re: git silently ignores include directive with single quotes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 10, 2018, 17:04 UTC
- Message-ID
- <xmqqr2i1thbs.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180908212256.GB31560@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 20 quoted lines
> 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.