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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/feature/gitaly.rb3
-rw-r--r--lib/gitlab/git/commit.rb3
-rw-r--r--lib/gitlab/legacy_github_import/user_formatter.rb5
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb
index d327162b34e..2d0fdf98e8c 100644
--- a/lib/feature/gitaly.rb
+++ b/lib/feature/gitaly.rb
@@ -14,6 +14,9 @@ class Feature
end
def server_feature_flags
+ # We need to check that both the DB connection and table exists
+ return {} unless ::Gitlab::Database.cached_table_exists?(FlipperFeature.table_name)
+
Feature.persisted_names
.select { |f| f.start_with?(PREFIX) }
.map do |f|
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index 0b999197cd8..605084f1ec2 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -93,12 +93,15 @@ module Gitlab
# Commit.last_for_path(repo, 'master', 'Gemfile')
#
def last_for_path(repo, ref, path = nil)
+ # rubocop: disable Rails/FindBy
+ # This is not where..first from ActiveRecord
where(
repo: repo,
ref: ref,
path: path,
limit: 1
).first
+ # rubocop: enable Rails/FindBy
end
# Get commits between two revspecs
diff --git a/lib/gitlab/legacy_github_import/user_formatter.rb b/lib/gitlab/legacy_github_import/user_formatter.rb
index 889e6aaa968..e85d1314eda 100644
--- a/lib/gitlab/legacy_github_import/user_formatter.rb
+++ b/lib/gitlab/legacy_github_import/user_formatter.rb
@@ -38,9 +38,8 @@ module Gitlab
identities = ::Identity.arel_table
User.select(:id)
- .joins(:identities).where(identities[:provider].eq(:github)
- .and(identities[:extern_uid].eq(id)))
- .first
+ .joins(:identities)
+ .find_by(identities[:provider].eq(:github).and(identities[:extern_uid].eq(id)))
.try(:id)
end
# rubocop: enable CodeReuse/ActiveRecord