Skip to content

rubyserver: Ensure we sync objects if there is no Rugged gitconfig

Patrick Steinhardt requested to merge pks-rugged-inject-own-gitconfig into master

The Gitaly config exposes a rugged_git_config_search_path config that allows the administrator to configure where Rugged should search for the gitconfig it is supposed to use. While this option rather feels like an edge case, it is in fact currently mandatory to set this configuration to a gitconfig that sets core.fsyncObjectFiles=true. If there is no such configuration, then the result is that Rugged will not flush newly written objects to disk, which can easily lead to repository corruption.

Luckily, both CNG and Omnibus know to set up this config as expected. But this brings its own problem with it: we have core.fsyncObjectFiles set in a central location now by distributions, which also means that Git as spawned by our Git command factory picks it up. But because that option has been deprecated in Git v2.36.0 this means that all Git commands would now print a warning. So we're between a rock and a hard place now: we must make sure that the configuration is set in Rugged, but it must not be present in the Git configuration.

Given that this is the only configuration that Rugged really needs, and given that it must always be present or we otherwise corrupt repos, we can fix this issue by simply writing our own Gitconfig file in case rugged_git_config_search_path is unset. Like this, we can stop setting the search path in distributions and eventually deprecate its use.

Part of #4230 (closed)

Fixes #4232 (closed)

Edited by Patrick Steinhardt

Merge request reports