sync_default_gems.rb: search the last merge more strictly [ci skip]

As tag-only match, `[#{repo}]`, may find unexpected commit, e.g.,
5bfca88f76 for io-console, match by
more exact URL pattern.
This commit is contained in:
Nobuyoshi Nakada 2021-03-28 22:58:43 +09:00
parent 49c1c2dce3
commit 36bad6f14f
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
1 changed files with 3 additions and 2 deletions

View File

@ -375,8 +375,9 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil)
system(*%W"git fetch --no-tags #{gem}")
if ranges == true
log = IO.popen(%W"git log --fixed-strings --grep=[#{repo}] -n1 --format=%B", &:read)
ranges = ["#{log[%r[https://github\.com/#{Regexp.quote(repo)}/commit/(\h+)\n\s*(?i:co-authored-by:.*)*\s*\Z], 1]}..#{gem}/master"]
pattern = "https://github\.com/#{Regexp.quote(repo)}/commit/([0-9a-f]+)$"
log = IO.popen(%W"git log -E --grep=#{pattern} -n1 --format=%B", &:read)
ranges = ["#{log[%r[#{pattern}\n\s*(?i:co-authored-by:.*)*\s*\Z], 1]}..#{gem}/master"]
end
commits = ranges.flat_map do |range|