ruby-changes:74341
From: Nobuyoshi <ko1@a...>
Date: Fri, 4 Nov 2022 15:44:08 +0900 (JST)
Subject: [ruby-changes:74341] b6d7e98f25 (master): sync_default_gems.rb: fix the position to insert the original URL
https://git.ruby-lang.org/ruby.git/commit/?id=b6d7e98f25 From b6d7e98f2540500f072c5cc0f136cae69f80055c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 4 Nov 2022 15:18:36 +0900 Subject: sync_default_gems.rb: fix the position to insert the original URL Since the regexp had expected an empty line before `Co-Authored-By:` trailer lines, it failed to match when the body has the trailer only. --- tool/sync_default_gems.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index d6b20a82bf..80eabab81c 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -441,9 +441,10 @@ def message_filter(repo, sha, input: ARGF) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L441 end url = "#{url}/commit/#{sha[0,10]}\n" if log and !log.empty? + log.sub!(/(?<=\n)\n+\z/, '') # drop empty lines at the last conv[log] - log.sub!(/\s*(?=(?i:\nCo-authored-by:.*)*\Z)/) { - "\n\n#{url}" + log.sub!(/(?:(\A\s*)|\s*\n)(?=(?i:Co-authored-by:.*)*\Z)/) { + $~.begin(0) ? "#{url}\n" : "\n\n#{url}" } else log = url -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/