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=4 enables 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=true requires that the filesystem supports mtimes correctly. This should be the case on macOS and Linux in general.
  • core.fsmonitor only works on macOS and Windows, on Linux it does not have an effect. This is because there is no Linux implementation of it.
  • core.fsmonitor spawns 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=true does 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 enable index.version=4core.untrackedCache=true and index.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=true plus core.fsmonitor=true might 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

  1. Run rm -rf gitlab-http-router
  2. Run make gitlab-http-router-update
  3. Run git -C gitlab-http-router config --list --local
  4. See that core.fsmonitor=true and feature.manyfiles=true are set

Impacted categories

The following categories relate to this merge request:

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 doctor test added, if needed.
Edited by Kev Kloss

Merge request reports

Loading