From a99bf447a24957cf11b89d4f04a2b84613367ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Tue, 2 Oct 2018 00:21:46 -0300 Subject: Remove Gitlab::Git::Repository#rugged and Gollum code Cleanup code, and refactor tests that still use Rugged. After this, there should be no Rugged code that access the instance's repositories on non-test environments. There is still some rugged code for other tasks like the repository import task, but since it doesn't access any repository storage path it can stay. --- config/initializers/8_metrics.rb | 12 ------------ config/initializers/gollum.rb | 28 ---------------------------- 2 files changed, 40 deletions(-) delete mode 100644 config/initializers/gollum.rb (limited to 'config') diff --git a/config/initializers/8_metrics.rb b/config/initializers/8_metrics.rb index 4d8d35bf6cf..eccf82ab8dc 100644 --- a/config/initializers/8_metrics.rb +++ b/config/initializers/8_metrics.rb @@ -3,7 +3,6 @@ # that we can stub it for testing, as it is only called when metrics are # enabled. # -# rubocop:disable Metrics/AbcSize def instrument_classes(instrumentation) instrumentation.instrument_instance_methods(Gitlab::Shell) @@ -48,16 +47,6 @@ def instrument_classes(instrumentation) instrumentation.instrument_methods(Premailer::Adapter::Nokogiri) instrumentation.instrument_instance_methods(Premailer::Adapter::Nokogiri) - [ - :Blame, :Branch, :BranchCollection, :Blob, :Commit, :Diff, :Repository, - :Tag, :TagCollection, :Tree - ].each do |name| - const = Rugged.const_get(name) - - instrumentation.instrument_methods(const) - instrumentation.instrument_instance_methods(const) - end - instrumentation.instrument_methods(Banzai::Renderer) instrumentation.instrument_methods(Banzai::Querying) @@ -101,7 +90,6 @@ def instrument_classes(instrumentation) # Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/30224#note_32306159 instrumentation.instrument_instance_method(MergeRequestDiff, :load_commits) end -# rubocop:enable Metrics/AbcSize # With prometheus enabled by default this breaks all specs # that stubs methods using `any_instance_of` for the models reloaded here. diff --git a/config/initializers/gollum.rb b/config/initializers/gollum.rb deleted file mode 100644 index ea9cc151a57..00000000000 --- a/config/initializers/gollum.rb +++ /dev/null @@ -1,28 +0,0 @@ -# WARNING changes in this file must be manually propagated to gitaly-ruby. -# -# https://gitlab.com/gitlab-org/gitaly/blob/master/ruby/lib/gitlab/gollum.rb - -module Gollum - GIT_ADAPTER = "rugged".freeze -end -require "gollum-lib" - -module Gollum - class Page - def text_data(encoding = nil) - data = if raw_data.respond_to?(:encoding) - raw_data.force_encoding(encoding || Encoding::UTF_8) - else - raw_data - end - - Gitlab::EncodingHelper.encode!(data) - end - end -end - -Rails.application.configure do - config.after_initialize do - Gollum::Page.per_page = Kaminari.config.default_per_page - end -end -- cgit v1.2.3