Skip to content

git: Add support for options which always get injected

Patrick Steinhardt requested to merge pks-git-inject-global-config into master

Traditionally, the gitconfig is not managed by the Gitaly project but by the various projects which deploy Gitaly or by the administrator himself if he chooses to do a source-based installation. Admins may have to potentially update the gitconfig on each upgrade of Gitaly while we as the Gitaly team need to ensure that all projects which deploy Gitaly (Docker, CNG, Omnibus and the likes) have the same gitconfig. Going by Murphy's law, this means that the git configuration for ways of installing Gitaly is going to diverge or has already diverged.

Running in an environment where we don't know that a set of config entries is set can be dangerous and may lead to incorrect results, failures or even data loss in the case of "core.fsyncObjectFiles" and "gc.auto".

This commit thus moves the global configuration into the Gitaly project to avoid any inconsistent environments. This allows us to ensure that required options are set while being quicker to iterate in case we need to change the configuration.

The injection is done via the git.ConfigPair{} mechanism, which will put all config entries on the command line via git -c <key>=<value> pairs. While it has the downside of being verbose, the current set of entries we inject is quite limited and contains only five different options, so we shouldn't be near any command line limits. Furthermore, we're currently in the process of upstreaming a new way of injecting config entries via the environment, which we can migrate to as soon as this git version has been released.

The list of injected configuration entries is taken from our source installation instructions.

Merge request reports