Windows上的Git子模块更新缓慢 [英] Git submodule update slow on Windows
问题描述
Git子模块在Windows上似乎非常慢.
Git submodule seems to be extremely slow on Windows.
为了测试性能,我创建了3个裸仓库,并向它们提交了3条独立消息(未存储任何文件).然后,我将这些裸仓库中的每个仓库作为子模块添加到新的git repo中,并执行了子模块更新,这花费了5秒钟以上.
To test the performance I created 3 bare repos and committed 3 independent messages to them (no files stored). I then added each of these bare repos as submodules in a new git repo and performed a submodule update and it took over 5 seconds.
在使用20多个子模块时,这似乎过分且非常明显.是什么原因导致它花费这么长时间?
This seems excessive and very noticeable when using 20+ submodules. What could be causing it to take so long?
示例文件: https://drive.google.com/file/d/1n6fAm16tXtt_1YvXbPHhn150iuw-VGOk/view
在子模块测试"中运行"git子模块更新".测试中的所有子模块URL都是相对的.
Run 'git submodule update' inside 'Submodule test'. All submodule URLs in the test are relative.
运行Git版本2.22.0.windows.1和版本2.23.0.windows.1
Running Git version 2.22.0.windows.1 and version 2.23.0.windows.1
修改:
使用常规命令行,git bash(如图所示),PowerShell和TortoiseGit进行了测试.
Tested using regular command line, git bash (as shown), PowerShell and TortoiseGit.
通过VonC建议的简化PATH测试.
Tested with simplified PATH as suggested by VonC.
推荐答案
尝试相同的方法:
- 使用Git 2.23
- 在常规CMD中
- 在该CMD中设置的简化的路径
然后查看问题是否仍然存在.
See if the issue persists then.
使用 Git 2.22(并在2.23中进行了改进),您可以使用以下方法测量Git命令的性能:>
With Git 2.22 (and improved in 2.23), you can measure the performance of a Git command with:
cmd /V /C "set GIT_TRACE2_PERF=C:/Users/me/log.perf&& git submodule update"
or in bash session:
GIT_TRACE2_PERF=C:/Users/me/log.perf git submodule update
这篇关于Windows上的Git子模块更新缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!