[前][次][番号順一覧][スレッド一覧]

ruby-changes:74102

From: Nobuyoshi <ko1@a...>
Date: Tue, 18 Oct 2022 17:44:04 +0900 (JST)
Subject: [ruby-changes:74102] e1ca90c2a4 (master): sync_default_gems.rb: fold too long subject [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=e1ca90c2a4

From e1ca90c2a4e392073480e7c0b4bed0b9948fad94 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 18 Oct 2022 12:13:06 +0900
Subject: sync_default_gems.rb: fold too long subject [ci skip]

Line with substituted issue references with URLs are often very long.
Although Git (and GitHub) recommends folding subject lines less than
50 columns, but many commits ignore this, so fold at 68 columns for
now.
---
 tool/sync_default_gems.rb | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 9fcbeb7d22..d7151af701 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -422,16 +422,30 @@ def message_filter(repo, sha) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L422
   log = STDIN.read
   log.delete!("\r")
   url = "https://github.com/#{repo}"
-  log.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K#(?=\d+\b)|\bGH-#?(?=\d+\b)|\(\K#(?=\d+\))/) {
-    "#{url}/pull/"
-  }
-  log.gsub!(%r{(?<![-\[\](){}\w@/])(?:(\w+(?:-\w+)*/\w+(?:-\w+)*)@)?(\h{10,40})\b}) {|c|
-    "https://github.com/#{$1 || repo}/commit/#{$2[0,12]}"
-  }
-  log.sub!(/\s*(?=(?i:\nCo-authored-by:.*)*\Z)/) {
-    "\n\n" "#{url}/commit/#{sha[0,10]}\n"
-  }
-  print "[#{repo}] ", log
+  subject, log = log.split("\n\n", 2)
+  conv = proc do |s|
+    mod = true if s.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K#(?=\d+\b)|\bGH-#?(?=\d+\b)|\(\K#(?=\d+\))/) {
+      "#{url}/pull/"
+    }
+    mod |= true if s.gsub!(%r{(?<![-\[\](){}\w@/])(?:(\w+(?:-\w+)*/\w+(?:-\w+)*)@)?(\h{10,40})\b}) {|c|
+      "https://github.com/#{$1 || repo}/commit/#{$2[0,12]}"
+    }
+    mod
+  end
+  subject = "[#{repo}] #{subject}"
+  subject.gsub!(/\s*\n\s*/, " ")
+  if conv[subject]
+    if subject.size > 68
+      subject.gsub!(/\G.{,67}[^\s.,][.,]*\K\s+/, "\n")
+    end
+  end
+  if log
+    conv[log]
+    log.sub!(/\s*(?=(?i:\nCo-authored-by:.*)*\Z)/) {
+      "\n\n" "#{url}/commit/#{sha[0,10]}\n"
+    }
+  end
+  print subject, "\n\n", log
 end
 
 # NOTE: This method is also used by GitHub ruby/git.ruby-lang.org's bin/update-default-gem.sh
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]