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

Bug with git-config includeIf

From
MBMatthias Beyer <mail@beyermatthias.de>
Date
Apr 11, 2023, 16:05 UTC
Message-ID
<3352350.44csPzL39Z@takeshi>
Hi,
please keep me in CC when replying, I am not subscribed.
I experience the following (seemingly) bug in my git setup:
I have three files for my git configuration:
* ~/.gitconfig -> ~/config/git/gitconfig
* ~/config/git/gitconfig_private
* ~/config/git/gitconfig_work

The gitconfig_private sets my email address to this very email address, the gitconfig_work sets it to me work email address.

The gitconfig file has a `includeIf` directive:
```
[include]
    path = ~/config/git/gitconfig_private                                                                                                                                                                                                                                                                                    
[includeIf "gitdir:~/dev/work/"]
    path = ~/config/git/gitconfig_work   
```

That means, from my understanding, that all git repositories in ~/dev/work should now have the work-related email address set.

If I go to ~/dev/work/somerepo and `git config --get user.email` it indeed shows the expected email address.

But if I go to a subdirectory in that repository, the very same command shows the private email address, and commits get written with that private email address.

Did I miss something obvious or did I discover a bug?
git: 2.38.4

Best, Matthias

Next: Junio C Hamano
Message 1 of 4 in “Bug with git-config includeIf”
  1. Matthias BeyerApr 11, 2023
  2. Junio C HamanoApr 11, 2023
  3. Matthias BeyerApr 12, 2023
  4. Emily ShafferApr 11, 2023

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.