问题
Git submodule seems to be extremely slow on Windows.
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.
This seems excessive and very noticeable when using 20+ submodules. What could be causing it to take so long?
Example files: https://drive.google.com/file/d/1n6fAm16tXtt_1YvXbPHhn150iuw-VGOk/view
Run 'git submodule update' inside 'Submodule test'. All submodule URLs in the test are relative.
Running Git version 2.22.0.windows.1 and version 2.23.0.windows.1
Edit:
Tested using regular command line, git bash (as shown), PowerShell and TortoiseGit.
Tested with simplified PATH as suggested by VonC.
回答1:
Try the same:
- with Git 2.23
- in a regular CMD
- with a simplified PATH set in that CMD
See if the issue persists then.
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
来源:https://stackoverflow.com/questions/57795214/git-submodule-update-slow-on-windows