1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Convert Enumerator to Array for Ruby 1.9.3

String#lines seems to return Enumerator in Ruby 1.9.3, and it does not
respond to #delete_if https://travis-ci.org/ruby/ruby/jobs/538559919
This commit is contained in:
Takashi Kokubun 2019-05-29 15:04:31 +09:00
parent 5379ca9250
commit 1a0c3d8dd6
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -407,7 +407,7 @@ class VCS
modified = log[/^Date:\s+(.*)/, 1]
branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref --short HEAD]])
if branch.empty?
branch_list = cmd_read_at(srcdir, [gitcmd + %W[branch --list --contains HEAD]]).lines
branch_list = cmd_read_at(srcdir, [gitcmd + %W[branch --list --contains HEAD]]).lines.to_a
branch_list.delete_if {|b| /detached at/ =~ b}
(branch = branch_list[0]).strip! unless branch_list.empty?
end