From 8bb0db4d2e667308821812d6973170d4d9c6a167 Mon Sep 17 00:00:00 2001 From: Will Chandler Date: Thu, 14 Sep 2023 10:59:07 -0400 Subject: git: Disable automatic maintenance By default a number of git commands will run git-maintenance(1) automatically, performing any maintenance tasks that are enabled for that repository. However, Gitaly never enables these tasks and handles maintenance itself, so we gain no benefit from running this process. There is no harm done to the repository, but we're wasting resources by running it at all. Disable it by setting config option `maintenance.auto=0` in our command factory. --- internal/git/command_factory.go | 3 +++ internal/git/command_factory_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go index bfb472030..c7e6b1036 100644 --- a/internal/git/command_factory.go +++ b/internal/git/command_factory.go @@ -586,6 +586,9 @@ func (cf *ExecCommandFactory) GlobalConfiguration(ctx context.Context) ([]Config // of it ourselves. {Key: "gc.auto", Value: "0"}, + // Disable automatic maintenance as we never enable any tasks. + {Key: "maintenance.auto", Value: "0"}, + // CRLF line endings will get replaced with LF line endings // when writing blobs to the object database. No conversion is // done when reading blobs from the object database. This is diff --git a/internal/git/command_factory_test.go b/internal/git/command_factory_test.go index 48d19bde3..b2cf5601d 100644 --- a/internal/git/command_factory_test.go +++ b/internal/git/command_factory_test.go @@ -606,6 +606,7 @@ func TestExecCommandFactory_config(t *testing.T) { expectedEnv := []string{ "gc.auto=0", + "maintenance.auto=0", "core.autocrlf=input", "core.usereplacerefs=false", "core.fsync=objects,derived-metadata,reference", -- cgit v1.2.3