summaryrefslogtreecommitdiff
path: root/tool/sync_default_gems.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-08-21 13:30:40 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-08-21 13:30:41 -0700
commit925ce3f4fbe2f05b8673a6dbc763ecab9f04fae1 (patch)
treee089e4dce0dac1f0c3060759fc92a595bcd17342 /tool/sync_default_gems.rb
parenteee83af34c726e564d6505a81545ddb73e976404 (diff)
Skip commits that are empty after conflict resolution
Diffstat (limited to 'tool/sync_default_gems.rb')
-rwxr-xr-xtool/sync_default_gems.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 9b9b0011ba..ce6a6dd0ae 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -558,16 +558,15 @@ module SyncDefaultGems
puts "Pick #{sha} from #{repo}."
# Attempt to cherry-pick a commit
- skipped = false
result = IO.popen(%W"git cherry-pick #{sha}", &:read)
if result =~ /nothing\ to\ commit/
`git reset`
- skipped = true
puts "Skip empty commit #{sha}"
+ next
end
- next if skipped
# Skip empty commits or deal with conflicts
+ skipped = false
if result.empty?
skipped = true
elsif /^CONFLICT/ =~ result
@@ -585,6 +584,7 @@ module SyncDefaultGems
end
ignored_paths.each do |path|
if File.exist?(path)
+ puts "Removing: #{path}"
system("git", "reset", path)
rm_rf(path)
end
@@ -609,6 +609,12 @@ module SyncDefaultGems
# UA: unmerged, added by them
# AA: unmerged, both added
unmerged = pipe_readlines(%W"git status --porcelain -z")
+ if unmerged.empty?
+ # Everything was removed as `ignored_paths`. Skip this commit.
+ `git reset` && `git checkout .` && `git clean -fd`
+ puts "Skip empty commit #{sha}"
+ next
+ end
# For YARP, we want to handle DD: deleted by both.
if gem == "yarp"