Re: [Bug report] includeIf config is not displayed in normal directories
- From
- Stuart MacDonald <stuartm.coding@gmail.com>
- Date
- Dec 16, 2020, 20:43 UTC
- Message-ID
- <CAPQE4+rhWT9kgusNXOw5cnJ-oFq++4G1FMaXvQ3wppQ0GE0hSA@mail.gmail.com>
- In-Reply-To
- <X9pe119edtL5KQTU@coredump.intra.peff.net>
On Wed, Dec 16, 2020 at 2:24 PM Jeff King <peff@peff.net> wrote:
> Perhaps. I have no objection to adding an option like that. But I don't > think it solves the fundamental issue in this bug report, which is > asking "what will the config look like in a repository that I created at > this path via git-init or git-clone?".
My fundamental issue was "git is using a conditionally included config option core.sshCommand while outside of a git repository, but git config is not displaying that config option when I ask it to". The good news is given the discussion in this thread I can now say that I was labouring under a misconception about how git clone works, and what I thought was a bug is normal expected behaviour.
My old understanding of git clone: - create sub-directory - create subdir/.git and whatever initial states are needed - clone the repo from origin into the directory - all never having left $CWD
It's actually: - create sub-directory - cd subdir - create ./.git and initial states - clone the repo _while inside_ a gitdir - cd ..
I would like to suggest that the documentation for either or both git clone and includeIf could be improved to talk about this case so that others having trouble with a conditionally included sshComand during cloning will not have to relearn the wheel.
I believe my misunderstanding was partially misled by the fact that despite the documentation for includeIf talking about it being a gitdir the part of that path being matched is not itself within a git directory; ~/work/git/git/.git was the end result, ~/work being the matched on part of the path and not in a git directory.
Show 5 quoted lines
> Maybe Stuart really would prefer to change his config to "whenever I am > in this directory root, repo or no, use this config". It does have weird > corner cases around "git --git-dir=/path/to/repo", but doing that from > another directory is perhaps rare enough that people using a cwd: > conditional would be happy to ignore that.
I do not. Hopefully this thread will also assist future includeIf trouble-havers.
Thanks all, very much appreciated. I consider the matter settled as 'working as designed'.