diff options
Diffstat (limited to 'internal/git/command_factory.go')
-rw-r--r-- | internal/git/command_factory.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go index 77ff1976c..ce23c76b0 100644 --- a/internal/git/command_factory.go +++ b/internal/git/command_factory.go @@ -17,6 +17,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v15/internal/log" + "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" ) // CommandFactory is designed to create and run git commands in a protected and fully managed manner. @@ -497,6 +498,12 @@ func (cf *ExecCommandFactory) globalConfiguration(ctx context.Context) ([]Global return nil, fmt.Errorf("determining Git version: %w", err) } + // Feature flag to change the default global configuration of autocrlf. + autocrlf := "input" + if featureflag.AutocrlfConfig.IsEnabled(ctx) { + autocrlf = "false" + } + // As global options may cancel out each other, we have a clearly defined order in which // globals get applied. The order is similar to how git handles configuration options from // most general to most specific. This allows callsites to override options which would @@ -518,7 +525,7 @@ func (cf *ExecCommandFactory) globalConfiguration(ctx context.Context) ([]Global // when writing blobs to the object database. No conversion is // done when reading blobs from the object database. This is // required for the web editor. - ConfigPair{Key: "core.autocrlf", Value: "input"}, + ConfigPair{Key: "core.autocrlf", Value: autocrlf}, // Git allows the use of replace refs, where a given object ID can be replaced with a // different one. The result is that Git commands would use the new object instead of the |