Re: Why does the includeif woks how it does?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 20, 2024, 01:42 UTC
- Message-ID
- <xmqqedd7ykq4.fsf@gitster.g>
- In-Reply-To
- <01d401da6379$635fdb30$2a1f9190$@nexbridge.com>
<rsbecker@nexbridge.com> writes:
> I have considered contributing an "includewhere" option that would > do that and differentiate from "includeif". I'm not sure it is > required, and what would happen with symbolic links.
Other potential gotchas would include how it interacts with directory hierarchies. You may be inside a directory /a/b (where none of /, /a, and /a/b is controlled by git) and want your "git init" invocation to be affected by some configuration included into your $HOME/.gitconfig via include-where mechanism. Would it work recursively? In other words, if you had
[includeIf "gitdir:/a/b"] path = $HOME/gits/a-b-in-repo
[includeIf "cwd:/"] path = $HOME/gits/others [includeIf "cwd:/a"] path = $HOME/gits/a [includeIf "cwd:/a/b"] path = $HOME/gits/a-b
would all of them be included? Just the last one? Does the most specific one win?
After your "git init" succeeds, the one specified with gitdir: would start kicking in. Would the "cwd:" ones that are meant for cases outside any directory under Git control be ignored then?
I am not opposed to such a feature existing at all; just pointing out there are sources of end-user confusion we need to be careful while we design the feature.