summaryrefslogtreecommitdiff
path: root/tool/sync_default_gems.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-08-17 22:04:24 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-08-17 22:12:38 -0700
commit6a6dacb0d1ce47d413d75b6e45d07a8b08ace3fb (patch)
tree09b810f2dfc25dd88db4c3d38494918fd987273c /tool/sync_default_gems.rb
parent7a2aeadb78687ed0a1bdb3062b59157f155bb5da (diff)
Attempt to recover from YARP sync failures
Diffstat (limited to 'tool/sync_default_gems.rb')
-rwxr-xr-xtool/sync_default_gems.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 91d326161d..242bbc07f2 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -571,19 +571,30 @@ module SyncDefaultGems
if result.empty?
skipped = true
elsif /^CONFLICT/ =~ result
- # Automatically fix some parts of conflicts
+ # Forcibly remove any files that we don't want to copy to this repository.
+ # We also ignore them as new `toplevels` even when they don't conflict.
case gem
when "rubygems"
- # git doesn't auto-rename new files under the vcr_cassettes to spec/bundler.
- # We delete them as `toplevels` if they don't conflict.
+ # We don't copy any vcr_cassettes to this repository. Because the directory does not
+ # exist, rename detection doesn't work. So it starts with the original path `bundler/`.
%w[bundler/spec/support/artifice/vcr_cassettes].each do |rem|
if File.exist?(rem)
system("git", "reset", rem)
rm_rf(rem)
end
end
- # New files renamed to spec/bundler are safe to commit.
+ end
+
+ # git has inexact rename detection, so they follow directory renames even for new files.
+ # However, new files are considered a `CONFLICT (file location)`, so you need to git-add them here.
+ # We hope that they are not other kinds of conflicts, assuming we don't modify them in this repository.
+ case gem
+ when "rubygems"
system(*%w[git add spec/bundler])
+ when "yarp"
+ system(*%w[git add lib/yarp])
+ system(*%w[git add test/yarp])
+ system(*%w[git add yarp])
end
# Discover unmerged files