Enable newer Git config options in component-git-clone
What does this merge request do and why?
This enables newer Git config options for any repositories that are cloned through GDK via component-git-clone.
This aims to improve performance of local git operations (e.g. git status from 1s to 0.1s in the gitlab-org/gitlab> repository).
A full explanation of the config options from @pks-gitlab (originally on Slack (internal)):
Some comments on this:
index.version=4enables path-prefix compression in the index. So it mostly reduces the size of the index a bit. It's existed for a rather long time, but it could still be that some applications that don't use Git directly don't understand it. I think it rather unlikely though.core.untracedCache=truerequires that the filesystem supports mtimes correctly. This should be the case on macOS and Linux in general.core.fsmonitoronly works on macOS and Windows, on Linux it does not have an effect. This is because there is no Linux implementation of it.core.fsmonitorspawns an additional daemon process that Git communicates with. There has been a known race in its startup that was fixed with GIt v2.47.1, but it should mostly be working good enough.core.preloadIndex=truedoes not have an effect as it is default-enabled anyway.My recommendation would be to not enable the individual options above, but rather
feature.manyFiles. This option will cause to enableindex.version=4,core.untrackedCache=trueandindex.skipHash=true, and may be extended in the future to cover additional options so that you don't have to care about keeping up to date with upstream changes.So
feature.manyFiles=truepluscore.fsmonitor=truemight be the most sensible combination.
In the future, we could add a doctor diagnostic to recommend this. Perhaps make it even easier with Make doctor diagnostics optionally correctable (#2152 - closed).
How to set up and validate locally
- Run
rm -rf gitlab-http-router - Run
make gitlab-http-router-update - Run
git -C gitlab-http-router config --list --local - See that
core.fsmonitor=trueandfeature.manyfiles=trueare set
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctortest added, if needed.