diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-13 12:44:39 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-17 08:54:18 +0300 |
commit | 596e9c2ef850342eda14acbe6680075df0ee77a6 (patch) | |
tree | fda2c7486cd901ecf213e21daa507df19b9a9046 | |
parent | 99c1774919705cee43849a6c6dd6ee8c91b3c7a5 (diff) |
ruby: Stop configuring `core.autocrlf`
The Ruby sidecar is still setting up `core.autocrlf` in some cases. Now
that we inject Git configuration via environment variables into the Ruby
sidecar though it's not required anymore to set this configuration:
- While libgit2 doesn't read the environment variables we're
injecting, it is not in fact using `core.autocrlf` in any of the
code paths we hit in the Ruby sidecar.
- The Git commands we spawn, of which only git-symbolic-ref(1) and
git-fetch(1) are left, don't care for the value of this config
either. But even if they did, the Git command factory does know to
set this value in the global Git configuration and thus we'd also
get it injected into the Ruby sidecar via environment variables.
So let's stop setting this key manually given that it's not needed
anymore.
-rw-r--r-- | ruby/lib/gitlab/git/operation_service.rb | 6 | ||||
-rw-r--r-- | ruby/lib/gitlab/git/repository.rb | 9 |
2 files changed, 0 insertions, 15 deletions
diff --git a/ruby/lib/gitlab/git/operation_service.rb b/ruby/lib/gitlab/git/operation_service.rb index 0ab311694..9a5d58219 100644 --- a/ruby/lib/gitlab/git/operation_service.rb +++ b/ruby/lib/gitlab/git/operation_service.rb @@ -60,8 +60,6 @@ module Gitlab # Returns [newrev, should_run_after_create, should_run_after_create_branch] def update_branch_with_hooks(branch_name, force) - update_autocrlf_option - was_empty = repository.empty? # Make commit @@ -139,10 +137,6 @@ module Gitlab ) end end - - def update_autocrlf_option - repository.autocrlf = :input if repository.autocrlf != :input - end end end end diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb index 92107b9c6..ba0ae3507 100644 --- a/ruby/lib/gitlab/git/repository.rb +++ b/ruby/lib/gitlab/git/repository.rb @@ -9,7 +9,6 @@ module Gitlab include Gitlab::Utils::StrongMemoize GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'.freeze - AUTOCRLF_VALUES = { 'true' => true, 'false' => false, 'input' => :input }.freeze RUGGED_KEY = :rugged_list GIT_ALLOW_SHA_UPLOAD = 'uploadpack.allowAnySHA1InWant=true'.freeze @@ -271,14 +270,6 @@ module Gitlab !has_visible_content? end - def autocrlf - AUTOCRLF_VALUES[rugged.config['core.autocrlf']] - end - - def autocrlf=(value) - rugged.config['core.autocrlf'] = AUTOCRLF_VALUES.invert[value] - end - def cleanup # Opening a repository may be expensive, and we only need to close it # if it's been open. |