summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDaniel Gerhardt <code@dgerhardt.net>2019-08-05 23:01:53 +0200
committerDaniel Gerhardt <code@dgerhardt.net>2019-08-06 00:08:59 +0200
commit33e10d700fe0fd2884465aea615aea85abdd0be1 (patch)
tree08aeb3bbcd991b2c391c5f4d55e9df3b5d82bd3a /app
parent0555bc64b8a4e7ae910ea5ab6754a83435bc52d8 (diff)
downloadgitlab-ce-33e10d700fe0fd2884465aea615aea85abdd0be1.tar.gz
Fix Ruby 2.5 compatibility for diverging counts of branches
!31480 does not fully restore compatibility because another Ruby 2.6 feature besides `Enumerable#filter` was used in commit ca5cd7b7. The use of `Enumerable#to_h`'s block is now replaced by an explicit `Enumerable#map` call. Error message: TypeError (wrong element type Gitlab::Git::Branch at 0 (expected array)): app/controllers/projects/branches_controller.rb:53:in `to_h' See https://bugs.ruby-lang.org/issues/15143. Fixes #64143.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/branches_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 141a7dfb923..e7bdb4b2042 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -49,7 +49,7 @@ class Projects::BranchesController < Projects::ApplicationController
branches = BranchesFinder.new(repository, params.permit(names: [])).execute
Gitlab::GitalyClient.allow_n_plus_1_calls do
- render json: branches.to_h { |branch| [branch.name, service.call(branch)] }
+ render json: branches.map { |branch| [branch.name, service.call(branch)] }.to_h
end
end
end