(Really) Fix Ruby 2.5 compatibility for diverging counts of branches
What does this MR do?
This MR complements !31480 (merged) which 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.
The following error message is logged with Ruby 2.5:
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 (closed).
Edited by Daniel Gerhardt