Re: Bug with git-config includeIf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 11, 2023 at 9:32 AM Matthias Beyer <mail@xxxxxxxxxxxxxxxx> wrote:
>
> 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.

One thing that can help a lot to debug is to run `git config --list
--show-scope` from this subdirectory where your config is misbehaving
- that will help you understand which of _private or _work is being
included in the parse, in which order. It could be there is another
stray config overwriting here.

>
> Did I miss something obvious or did I discover a bug?
>
> git: 2.38.4
>
> Best,
> Matthias




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux