diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-08-15 09:29:00 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-08-16 17:47:32 -0700 |
commit | c5dad5f1d74e4d1acbae943e00a9465a7c921fa5 (patch) | |
tree | 2cadafac960c37e130ae99af946073195e4eb590 /tool/sync_default_gems.rb | |
parent | f339937abb6a5057a7ed57c52dad708349db5412 (diff) |
Sync script updates
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8226
Diffstat (limited to 'tool/sync_default_gems.rb')
-rwxr-xr-x | tool/sync_default_gems.rb | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index d2c17f35af..f0f091e1c5 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -371,7 +371,7 @@ module SyncDefaultGems `git checkout ext/digest/depend ext/digest/*/depend` when "set" sync_lib gem, upstream - cp_r(Dir.glob("#{upstream}/test/*"), "test/set") + cp_r("#{upstream}/test", ".") when "optparse" sync_lib gem, upstream rm_rf(%w[doc/optparse]) @@ -420,7 +420,7 @@ module SyncDefaultGems cp_r("#{upstream}/include/yarp/.", "yarp") cp_r("#{upstream}/include/yarp.h", "yarp") - rm("yarp/config.h") + rm_f("yarp/config.h") File.write("yarp/config.h", "#include \"ruby/config.h\"\n") rm("yarp/extconf.rb") @@ -441,6 +441,27 @@ module SyncDefaultGems |test\/lib\/.* )\z/mx + YARP_IGNORE_FILE_PATTERN = + /\A(?:[A-Z]\w*\.(?:md|txt) + |[^\/]+\.yml + |\.gitignore + |\.git.* + |[A-Z]\w+file + |COPYING + |CONTRIBUTING\.md + |Gemfile + |Gemfile\.lock + |Makefile\.in + |README\.md + |bin\/.* + |configure\.ac + |rakelib\/.* + |templates\/.* + |test\/lib\/.* + |tasks\/.* + |ext\/yarp\/extconf\.rb + )\z/mx + def message_filter(repo, sha, input: ARGF) log = input.read log.delete!("\r") @@ -508,9 +529,15 @@ module SyncDefaultGems end # Ignore Merge commit and insufficiency commit for ruby core repository. + case gem + when "yarp" + ignore_file_pattern = YARP_IGNORE_FILE_PATTERN + else + ignore_file_pattern = IGNORE_FILE_PATTERN + end commits.delete_if do |sha, subject| files = pipe_readlines(%W"git diff-tree -z --no-commit-id --name-only -r #{sha}") - subject.start_with?("Merge", "Auto Merge") or files.all?(IGNORE_FILE_PATTERN) + subject.start_with?("Merge", "Auto Merge") or files.all?(ignore_file_pattern) end if commits.empty? @@ -559,7 +586,7 @@ module SyncDefaultGems result = pipe_readlines(%W"git status --porcelain -z") result.map! {|line| line[/\A(?:.U|[UA]A) (.*)/, 1]} result.compact! - ignore, conflict = result.partition {|name| IGNORE_FILE_PATTERN =~ name} + ignore, conflict = result.partition {|name| ignore_file_pattern =~ name} unless ignore.empty? system(*%W"git reset HEAD --", *ignore) File.unlink(*ignore) @@ -600,7 +627,7 @@ module SyncDefaultGems puts "Remove files added to toplevel: #{toplevels.join(', ')}" system(*%w"git rm -r --", *toplevels) end - tools = changed.select {|f|f.start_with?("test/fixtures/", "test/lib/", "tool/")} + tools = changed.select {|f|f.start_with?("test/lib/", "tool/")} unless tools.empty? system(*%W"git rm -r --", *tools) system(*%W"git checkout HEAD~ --", *tools) |