git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug report] includeIf config is not displayed in normal directories

From
SMStuart 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'.

Previous: Jeff KingNext: Junio C Hamano
Message 4 of 8 in “[Bug report] includeIf config is not displayed in normal directories”
  1. Stuart MacDonaldDec 15, 2020
  2. Junio C HamanoDec 15, 2020
  3. Jeff KingDec 16, 2020
  4. Stuart MacDonaldDec 16, 2020
  5. Junio C HamanoDec 16, 2020
  6. Jeff KingDec 18, 2020
  7. Ævar Arnfjörð BjarmasonDec 15, 2020
  8. Junio C HamanoDec 16, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.