ruby-changes:56669
From: Hiroshi <ko1@a...>
Date: Fri, 26 Jul 2019 18:38:47 +0900 (JST)
Subject: [ruby-changes:56669] Hiroshi SHIBATA: 95aa60f6cd (master): Ignore Merge commit and insufficiency commit for ruby core repository.
https://git.ruby-lang.org/ruby.git/commit/?id=95aa60f6cd From 95aa60f6cde1ab7bc5cfe33c95c4fd2d2154cd52 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Fri, 26 Jul 2019 17:14:32 +0800 Subject: Ignore Merge commit and insufficiency commit for ruby core repository. diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 599d6b3..cb9492f 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -238,31 +238,39 @@ def sync_default_gems_with_commits(gem, range) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L238 end `git fetch --no-tags #{gem}` + commits = [] + IO.popen(%W"git log --format=%H,%s #{range}") do |f| commits = f.read.split("\n").reverse.map{|commit| commit.split(',')} + end - # Ignore Merge commit for ruby core repository. - commits.delete_if{|_, subject| subject =~ /^Merge/} - - puts "Try to pick these commits:" - puts commits.map{|commit| commit.join(": ")}.join("\n") + # Ignore Merge commit and insufficiency commit for ruby core repository. + commits.delete_if do |sha, subject| + files = [] + IO.popen(%W"git diff-tree --no-commit-id --name-only -r #{sha}") do |f| + files = f.read.split("\n") + end + subject =~ /^Merge/ || files.all?{|file| file =~ /(\.travis.yml|appveyor\.yml|azure\-pipelines\.yml|\.gitignore|Gemfile|README\.md)/} + end - commits.each do |sha, subject| - puts "Pick #{sha} from #{$repositories[gem.to_sym]}." + puts "Try to pick these commits:" + puts commits.map{|commit| commit.join(": ")}.join("\n") + puts "----" - `git cherry-pick #{sha}` - unless $?.success? - puts "Failed to pick #{sha}" - break - end + commits.each do |sha, subject| + puts "Pick #{sha} from #{$repositories[gem.to_sym]}." - prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/') - suffix = "https://github.com/#{($repositories[gem.to_sym])}/commit/#{sha[0,10]}" - `git filter-branch -f --msg-filter 'sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD` - unless $?.success? - puts "Failed to modify commit message of #{sha}" - break - end + `git cherry-pick #{sha}` + unless $?.success? + puts "Failed to pick #{sha}" + break + end + prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/') + suffix = "https://github.com/#{($repositories[gem.to_sym])}/commit/#{sha[0,10]}" + `git filter-branch -f --msg-filter 'sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD` + unless $?.success? + puts "Failed to modify commit message of #{sha}" + break end end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/