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

ruby-changes:65904

From: Hiroshi <ko1@a...>
Date: Wed, 21 Apr 2021 20:46:55 +0900 (JST)
Subject: [ruby-changes:65904] 7c0c1c3e46 (master): This change broke the some files like date.gemspec and lib/logger.rb.

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

From 7c0c1c3e4683cf4569b29e6a2d9eb44358268d14 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Wed, 21 Apr 2021 17:38:33 +0900
Subject: This change broke the some files like date.gemspec and lib/logger.rb.

Revert "sync_default_gems.rb: merge only files named as each gem"

This reverts commit 37b96d6773a2151fb3193cab6b9e3f7328915844.
---
 tool/sync_default_gems.rb | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 1c69785..1a5de83 100644
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -353,6 +353,16 @@ def sync_default_gems(gem) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L353
   end
 end
 
+IGNORE_FILE_PATTERN =
+  /\A(?:[A-Z]\w*\.(?:md|txt)
+  |[^\/]+\.yml
+  |\.git.*
+  |[A-Z]\w+file
+  |COPYING
+  )\z|
+  |rakelib\/
+  /x
+
 def message_filter(repo, sha)
   log = STDIN.read
   print "[#{repo}] ", log.sub(/\s*(?=(?i:\nCo-authored-by:.*)*\Z)/) {
@@ -364,11 +374,6 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L374
   repo = REPOSITORIES[gem.to_sym]
   puts "Sync #{repo} with commit history."
 
-  file_pattern = gem == repo ? gem : "{#{gem},#{repo}}"
-  file_pattern = "*/#{file_pattern}{,.*,/**/*}"
-  fnm_option = File::FNM_PATHNAME | File::FNM_DOTMATCH
-  file_match = proc {|file| File.fnmatch?(file_pattern, file, fnm_option)}
-
   IO.popen(%W"git remote") do |f|
     unless f.read.split.include?(gem)
       `git remote add #{gem} git@g...:#{repo}.git`
@@ -394,9 +399,8 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L399
 
   # Ignore Merge commit and insufficiency commit for ruby core repository.
   commits.delete_if do |sha, subject|
-    next true if /^(?:Auto )?Merge/ =~ subject
-    IO.popen(%W"git diff-tree --no-commit-id --name-only -r #{sha}", &:read)
-      .split("\n").none?(&file_match)
+    files = IO.popen(%W"git diff-tree --no-commit-id --name-only -r #{sha}", &:readlines)
+    subject =~ /^Merge/ || subject =~ /^Auto Merge/ || files.all?{|file| file =~ IGNORE_FILE_PATTERN}
   end
 
   if commits.empty?
@@ -433,9 +437,10 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L437
     if result.empty?
       skipped = true
     elsif /^CONFLICT/ =~ result
-      result = IO.popen(%W"git status --porcelain", &:readlines).map! {|line| line[/^.U (.*)/, 1]}
+      result = IO.popen(%W"git status --porcelain", &:readlines).each(&:chomp!)
+      result.map! {|line| line[/^.U (.*)/, 1]}
       result.compact!
-      conflict, ignore = result.partition(&file_match)
+      ignore, conflict = result.partition {|name| IGNORE_FILE_PATTERN =~ name}
       unless ignore.empty?
         system(*%W"git reset HEAD --", *ignore)
         File.unlink(*ignore)
-- 
cgit v1.1


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

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