diff options
-rwxr-xr-x | tool/sync_default_gems.rb | 6 | ||||
-rwxr-xr-x | tool/test/test_sync_default_gems.rb | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 44f11e22d2..02e73b254a 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -449,7 +449,11 @@ module SyncDefaultGems log.delete!("\r") log << "\n" if !log.end_with?("\n") repo_url = "https://github.com/#{repo}" - subject, log = log.split(/\n(?:[ \t]*(?:\n|\z))/, 2) + + # Split the subject from the log message according to git conventions. + # SPECIAL TREAT: when the first line ends with a dot `.` (which is not + # obeying the conventions too), takes only that line. + subject, log = log.split(/\A.+\.\K\n(?=\S)|\n(?:[ \t]*(?:\n|\z))/, 2) conv = proc do |s| mod = true if s.gsub!(/\b(?:(?i:fix(?:e[sd])?|close[sd]?|resolve[sd]?) +)\K#(?=\d+\b)|\bGH-#?(?=\d+\b)|\(\K#(?=\d+\))/) { "#{repo_url}/pull/" diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index 489feb2894..b48b51bb52 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -73,6 +73,15 @@ module Test_SyncDefaultGems ] assert_message_filter(expected, trailers, [expected, "", trailers].join("\n")) end + + def test_dot_ending_subject + expected = [ + "subject with a dot.", + "", + "- next body line", + ] + assert_message_filter(expected, nil, [expected[0], expected[2], ""].join("\n")) + end end class TestSyncWithCommits < Test::Unit::TestCase |