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

String#[] with index to extract matched substring safely

This commit is contained in:
Nobuyoshi Nakada 2019-04-30 22:13:47 +09:00
parent 1dd94dfba3
commit df3de40932
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -316,7 +316,7 @@ else
end
patch = resp.body
message = "\n\n#{(patch.match(/^Subject: (.*)\n\ndiff --git/m)&.[](1) || "Message not found for revision: #{git_rev}\n")}"
message = "\n\n#{(patch[/^Subject: (.*)\n\ndiff --git/m, 1] || "Message not found for revision: #{git_rev}\n")}"
puts '+ git apply'
IO.popen(['git', 'apply'], 'w') { |f| f.write(patch) }
else