2014:请注意,即使有这样的配置,git 2.0.1(2014 年 6 月 25 日)仍然会向您显示已上演的子模块。
See 提交 1d2f393 by 延斯·莱曼 (jlehmann)
当前设置submodule.<name>.ignore
and/or diff.ignoreSubmodules
to "all
" 抑制 diff 系列、状态和提交的子模块更改的所有输出。
对于状态和提交来说,这确实令人困惑,因为即使用户选择通过手动添加来记录被忽略的子模块的新提交,此更改也不会显示在要提交的更改下。
雪上加霜的是,稍后的“git commit”将错误显示“nothing to commit
" 当仅暂存被忽略的子模块时。
通过制作来解决这个问题wt_status
无论配置了什么忽略设置,始终打印分阶段的子模块更改。
唯一的例外是当用户明确使用“--ignore-submodules=all
" 命令行选项,在这种情况下子模块输出仍然被抑制。
这也使得“git commit
当仅暂存被忽略的子模块的修改时,再次工作,因为该命令使用wt_status
struct 来确定是否存在分阶段更改。
也可以看看提交 c215d3d为了git commit
part.
雪上加霜的是,当仅暂存被忽略的子模块时,稍后的“git commit”将会错误并显示“无可提交”。
Actually... with Git 2.42 (Q3 2023), even when diff.ignoreSubmodules
tells us to ignore submodule changes, "git commit"(man) with an index that already records changes to submodules should include the submodule changes in the resulting commit, but it did not.
And this has been fixed!
See commit 5768478 (14 Jun 2023) by Josip Sokcevic (sokac).
(Merged by Junio C Hamano -- gitster -- in commit 4ee088d, 23 Jun 2023)
diff-lib: honor override_submodule_config
标志位
Signed-off-by: Josip Sokcevic
When diff.ignoreSubmodules = all
已设置并且子模块提交是手动暂存的(例如通过git-update-index
), git-commit
应记录更新子模块的提交。
index_differs_from
被调用自prepare_to_commit
标志设置为override_submodule_config = 1
.
index_differs_from
然后合并默认的差异标志和传递的标志。
When diff.ignoreSubmodules
被设定为 ”all
", flags
最终两者兼而有之override_submodule_config
and ignore_submodules
设置为 1。这会导致git-commit
忽略分阶段提交。
这个补丁恢复原来的flags.ignore_submodule
if flags.override_submodule_config
is set.