“includeif”在 git-for-windows 上不起作用

cro*_*wne 5 git git-for-windows

我最近升级了git version 2.33.1.windows.1
,但includeif似乎不起作用。
还有人可以确认吗?我不记得我以前的 git 版本是什么。

我的配置如下:

.gitconfig

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir:E:/work/**"]
  path = ~/.gitconfig_work
Run Code Online (Sandbox Code Playgroud)

.gitconfig_work

[user]
    name = name.surname
    email = name.surname@work.com
Run Code Online (Sandbox Code Playgroud)

我升级的原因是,它includeif没有
在下面嵌套多个目录的目录上递归生效E:/work/

自从升级之后,似乎根本没有生效。

>git config -l --show-origin

仅显示来自以下内容的条目:

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

我没有看到来自以下位置的任何条目:

  • C:/Users/crown/.gitconfig_work

Kar*_*are 7

我尝试过 git v2.35.1,对我来说神奇的是,**最后删除了并保留了尾部斜杠/。我还添加了/i忽略不区分大小写的选项。

.gitconfig,对我有用

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/"]
  path = ~/.gitconfig_work
Run Code Online (Sandbox Code Playgroud)

不工作

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/**"]
  path = ~/.gitconfig_work
Run Code Online (Sandbox Code Playgroud)

不工作 b)

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work"]
  path = ~/.gitconfig_work
Run Code Online (Sandbox Code Playgroud)

  • ubuntu下的类似问题,从 Bionic (git v2.17) 切换到 Focal (git v2.25.1) 后,我有 `[includeIf "gitdir:~/workspace/*"]` 并且它在旧版本下工作。现在我删除 * : `[includeIf "gitdir:~/workspace/"]` 相当于 _/home/myusername/workspace/**_ 并且它工作正常,/sf/answers/3788817301/ (2认同)