Re: git silently ignores include directive with single quotes
- Date: Sat, 8 Sep 2018 13:58:59 -0700
- From: Stas Bekman <stas@xxxxxxxxxx>
- Subject: Re: git silently ignores include directive with single quotes
On 2018-09-08 01:28 PM, Ævar Arnfjörð Bjarmason wrote:
> Yeah, some version of this is sensible. There's at least a doc patch in
> here somewhere, if not some "warn if missing" mode.
> So don't take any of this as minimizing that aspect of your bug report.
> There's just no way that "git" the tool can somehow in a sane way rescue
> you from knowing the quoting rules of the shell on your system, which
> differ wildly between the likes of Windows and Linux.
I understand. All your explanations are perfectly reasonable, Ævar.
Yet, there needs to be some way for a user to know that git ignored
something if their configuration doesn't work as expected.
1) I suggest this is done via:
git config --list --show-origin
where the new addition would be to also show configuration parts that
are not active and indicating why it is so.
So for example currently I get on a valid configuration setup and having
git/../.gitconfig in place the following output:
Now, if include.path=../.gitconfig is there and file:.git/../.gitconfig
is not found, it will indicate that in some way that stands out for the
file:.git/../.gitconfig FILE NOT FOUND! Ignored configuration
So that would allow things to work as before, but now we have a way to
debug user-side configuration. And of course hoping that the docs would
indicate that method for debugging configuration problems.
I hope this is a reasonable suggestion that doesn't require any
modification on the users' part who rely on this silent ignoring
"feature", yet lending to a configuration debug feature.
2) And a secondary suggestion I mentioned earlier is to also have a flag
for git config to validate the path as it is being configured:
git config --local include.path '../.gitconfig' --validate-path
so that on shells that deal with quoting differently, than what git
expects, this git command will fail saying:
error: can't find file:.git/'../.gitconfig'
or at the very least give a warning if we don't want it be fatal. Though
I see no problem with it being fatal if a user uses a special flag.
I made this second suggestion since it will help users to detect the
problem early on. Before they need to search for another debug solution
such as the first one suggested in this email.
3) Finally, it'd be useful to have GIT_TRACE=1 state that so and so
include path wasn't found and was ignored during various 'git whatever'
I am open to any or all of these solutions, or alternative suggestions
Stas Bekman <'))))>< <'))))><