summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-02-08 17:14:45 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-02-08 18:01:14 +0100
commit1535dedcb6d42659016297fd064ae11f52fed928 (patch)
tree38e92430d3230eb70099d2db9b4eb86cac55107b
parent3da8cfc695bda5dbcae0f224fe0b500bf2acddbf (diff)
downloadgitlab-ce-fix/remove-n-plus-one-from-branches-filter.tar.gz
Remove allow_n_plus_1 from Git::Repository#branches_filterfix/remove-n-plus-one-from-branches-filter
-rw-r--r--lib/gitlab/git/repository.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 6761fb0937a..5f014e43c6f 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1614,17 +1614,14 @@ module Gitlab
# Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'.
def branches_filter(filter: nil, sort_by: nil)
- # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37464
- branches = Gitlab::GitalyClient.allow_n_plus_1_calls do
- rugged.branches.each(filter).map do |rugged_ref|
- begin
- target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target)
- Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit)
- rescue Rugged::ReferenceError
- # Omit invalid branch
- end
- end.compact
- end
+ branches = rugged.branches.each(filter).map do |rugged_ref|
+ begin
+ target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target)
+ Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit)
+ rescue Rugged::ReferenceError
+ # Omit invalid branch
+ end
+ end.compact
sort_branches(branches, sort_by)
end