在 Git 中克隆时收到 "core.useBuiltinFSMonitor will be deprecated soon" 消息

Receiving "core.useBuiltinFSMonitor will be deprecated soon" message while cloning in Git

我最近安装了 git version 2.36.0.windows.1 并且在克隆一个 repo 之后我收到了以下消息。

hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead

hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"

将值更改为 false 会禁用消息。

我的问题是:

  1. 什么是 core.useBuiltinFSMonitorcore.fsmonitor
  2. 考虑到我刚刚安装 Git,为什么不将值自动设置为 false 而是要求用户这样做?

谢谢!


编辑: 将我之前的编辑作为单独的答案放在下面。

release notes for Git for Windows 2.30.2(2021 年 3 月)提供了一些线索:

Git for Windows now ships with an experimental built-in file-system monitor, without the need to install Watchman and setting core.fsmonitor. It can be turned on by setting both feature.manyFiles=true and feature.experimental=true (or directly, via core.useBuiltinFSMonitor=true).

core.useBuiltinFSMonitor 没有记录在 the Git website, even on an older version where it should exist 上,但它似乎是为想要生活在最前沿的用户启用 built-in 文件系统监视器的设置。

您在问题中引用的提示表明此功能现在被认为足够稳定,可以作为默认功能。事实上,如果我们查看 the documentation for core.fsmonitor,我们就会发现情况就是这样¹:

If set to true, enable the built-in file system monitor daemon for this working directory

older documentation 显示此设置在此更改之前确实存在,但它用于指向用作监视器的外部命令。)

该文档还解释了为什么我们首先需要一个文件系统监视器,以及为什么 built-in 监视器更可取:

Like hook-based file system monitors, the built-in file system monitor can speed up Git commands that need to refresh the Git index (e.g. git status) in a working directory with many files. The built-in monitor eliminates the need to install and maintain an external third-party tool.

至于为什么您在克隆时会收到此警告,我不确定。您的主目录中是否已经有一个全局 .gitconfig 文件?可能是您的雇主作为默认配置的一部分提供的?


¹在撰写本文时,此功能被记录为仅在 Windows 和 macOS 上可用。

感谢 Chris 的解释和查看链接。

TL;DR

可以安全地使用命令 git config --global core.fsmonitor true 永久删除该消息。

Chris 回答中的内容和原因的答案如下。


  1. 似乎两者是相互关联的,因此他们还没有禁用一个。

The new FSMonitor feature is controlled by the core.useBuiltinFSMonitor boolean. Link

  1. 在最近的 post 中,他们似乎 解决了这个问题

So I understand that the builtin FS monitor is not actually deprecated, just that the name in the config is going to change, is there, on the current version, any way to use the new name or is the only way to get rid of the message to disable it via the provided command?

I guess we should clarify by saying core.useBuiltinFSMonitor=true was experimental, please set core.fsmonitor=true` instead. Link

  1. 最后,提示的原因:

With the feature going upstream into core Git, a decision was made to overload the existing core.fsmonitor setting to take a hook-pathname or a boolean value for the builtin FSMonitor. However, users may have multiple versions of Git installed on their systems on Windows. One in the C:/program files/... and hidden versions installed by tools like Visual Studio. And these may be at different revision levels, so one install might only understand the old keyword and one version might understand both (during the transition). So, auto transitioning it would break whichever one is the older release. So it's safer to just warn the user and let them decide. (And if they know they have multiple versions, they can just set both for now.) Link

简短的解决方案 - 针对 Windows 用户 - 删除消息:

  • 编辑文件C:\Program Files\Git\etc\gitconfig

  • 在部分中添加行:

    [核心]

    fsmonitor = 真

  • 使用提升的权限保存文件