diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb index 6ebfb9e93b81ad..26c9763c13cc11 100644 --- a/tool/lib/vcs.rb +++ b/tool/lib/vcs.rb @@ -448,11 +448,10 @@ def export(revision, url, dir, keep_temp = false) end def branch_beginning(url) - files = %w[version.h include/ruby/version.h] - year = cmd_read(%W[ #{COMMAND} log -n1 --format=%cd --date=format:%Y #{url} --] + files).to_i + year = cmd_read(%W[ #{COMMAND} log -n1 --format=%cd --date=format:%Y #{url} --]).to_i cmd_read(%W[ #{COMMAND} log --format=format:%H --reverse --since=#{year-1}-12-25 --author=matz --committer=matz --grep=started\\.$ - #{url} --] + files)[/.*/] + #{url} -- version.h include/ruby/version.h])[/.*/] end def export_changelog(url = '@', from = nil, to = nil, _path = nil, path: _path, base_url: true) @@ -460,7 +459,7 @@ def export_changelog(url = '@', from = nil, to = nil, _path = nil, path: _path, rev or next rev unless rev.empty? end - unless (from && /./.match(from)) or ((from = branch_beginning(url)) && /./.match(from)) + unless from&.match?(/./) or (from = branch_beginning(url))&.match?(/./) warn "no starting commit found", uplevel: 1 from = nil end