Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-20 10:04:15 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-25 09:38:19 +0300
commit7224e71bc7684578950b193f8130a4ce123f63ab (patch)
tree576c21ebe87e0f3a29628866e8310fb9b442aa43
parent88445f77ab854bfd278fe1bcebaed2d0d131ea96 (diff)
gitaly/config: Add option to ignore gitconfig files
We're deprecating use of gitconfig files which exist in the filesystem in favor of adding `[[git.config]]` entries to Gitaly's `config.toml`. Add a new option that allows distributions to opt-in to this new behaviour so that they can migrate earlier if they decide to. This will become the default with release 16.0. Changelog: added
-rw-r--r--config.toml.example8
-rw-r--r--internal/git/command_factory.go2
-rw-r--r--internal/gitaly/config/config.go1
3 files changed, 10 insertions, 1 deletions
diff --git a/config.toml.example b/config.toml.example
index ae1b54e1a..9a4753e1e 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -37,6 +37,14 @@ bin_dir = "/home/git/gitaly/_build/bin"
# [git]
# bin_path = "/usr/bin/git"
# catfile_cache_size = 100
+#
+# # Set this setting to `true` to start ignoring gitconfig files installed in
+# # the system. This includes both system-level (e.g. '/etc/gitconffig') and
+# # global-level (e.g. `$HOME/.gitconfig`) files. This setting will become the
+# # default with v16.0. If you intend to override Git configuration you can do
+# # so via `[[git.config]]`. The default value is `false`.
+# ignore_gitconfig = false
+#
# [[git.config]]
# key = fetch.fsckObjects
# value = true
diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go
index 17b2a85de..8fe94a63e 100644
--- a/internal/git/command_factory.go
+++ b/internal/git/command_factory.go
@@ -164,7 +164,7 @@ func setupGitExecutionEnvironments(cfg config.Cfg, factoryCfg execCommandFactory
// that to check whether to ignore the globals or not.
//
// See https://gitlab.com/gitlab-org/gitaly/-/issues/3617.
- if strings.HasSuffix(os.Args[0], ".test") {
+ if strings.HasSuffix(os.Args[0], ".test") || cfg.Git.IgnoreGitconfig {
sharedEnvironment = append(sharedEnvironment,
"GIT_CONFIG_GLOBAL=/dev/null",
"GIT_CONFIG_SYSTEM=/dev/null",
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go
index 23fd6d7fa..a7b70842c 100644
--- a/internal/gitaly/config/config.go
+++ b/internal/gitaly/config/config.go
@@ -107,6 +107,7 @@ type Git struct {
BinPath string `toml:"bin_path"`
CatfileCacheSize int `toml:"catfile_cache_size"`
Config []GitConfig `toml:"config"`
+ IgnoreGitconfig bool `toml:"ignore_gitconfig"`
}
// GitConfig contains a key-value pair which is to be passed to git as configuration.