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
That would allow things like:
[diff "foo"]
textconv = some_shell_hackery 'with quotes' | foo
to continue working, but make:
[some]
path = 'this has "double quotes" in it!'
do what the user probably intended. It would be a regression for anybody
who literally has a value that starts with a single-quote, but that
seems like it would be pretty rare. Or I dunno, maybe people do it on
Windows to try to protect path-names that get interpreted by the shell.
> The original problem cropped up due to using:
>
> git config --local include.path '../.gitconfig'
>
> which on linux stripped the single quotes, but on some windows git bash
> emulation it kept them.
That sounds like a bug in git bash, if it is not treating single quotes
in the usual shell way. But I'd also expect such a bug to cause loads of
problems in all of the shell scripts. Are you sure it wasn't cmd.exe or
some other interpreter?
-Peff