git submodule update --recursive 是否覆盖 fetchRecurseSubmodules?

Does git submodule update --recursive override fetchRecurseSubmodules?

我有一个我不需要的子模块。例如:

mainProject
  - usefulSubmodule
    - notNeededSubmodule

所以在 mainProject 中,我这样定义 .gitmodules

[submodule "usefulSubmodule"]
    path = lib/usefulSubmodule
    url = https://whatever
    fetchRecurseSubmodules = false

然后我 运行 git submodule update --init --recursive 更新后,这似乎忽略了 fetchRecurseSubmodules 的值(根据文档我猜这可能是真的 https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtfetchRecurseSubmodules )

因此我的问题是,如何在更新期间禁用此行为而不覆盖它?在尊重该标志的同时更新我所有子模块的最佳方法是什么?

So is on-demand the default for this property if it is not present?

是的,这就是 git config fetch.recurseSubmodules 指定的内容:

When set to on-demand (the default value), fetch and pull will only recurse into a populated submodule when its superproject retrieves a commit that updates the submodule’s reference.

注意:如果您想在本地覆盖(仅针对一个命令)配置:

git -c fetch.recurseSubmodules=on-demand submodule update --init

但在这种情况下,不需要(这只是为了说明如何为一个 git 命令设置配置)