'includeif' is not working on git-for-windows

Viewed 726

I've recently upgraded to git version 2.33.1.windows.1
and includeif does not seem to be working.
Can anyone else confirm? I can't remember what my previous git version was.

My config is as follows:

.gitconfig

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir:E:/work/**"]
  path = ~/.gitconfig_work

.gitconfig_work

[user]
    name = name.surname
    email = name.surname@work.com

The reason I upgraded was that the includeif was not taking effect recursively
on directories nested more than one directory below E:/work/

Since the upgrade it doesn't seem to be taking effect at all.

>git config -l --show-origin

Only shows entries from:

  • C:/Program Files/Git/etc/gitconfig
  • C:/Users/crowne/.gitconfig

I don't see any entries from:

  • C:/Users/crowne/.gitconfig_work
1 Answers

I have tried git v2.35.1 and the magic was for me, to drop the ** in the end and keep the trailing slash / alone. I added also the /i option to ignore be case-insensitive.

.gitconfig, which worked for me

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/"]
  path = ~/.gitconfig_work

not working a)

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/**"]
  path = ~/.gitconfig_work

not working b)

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work"]
  path = ~/.gitconfig_work
Related