diff --git a/patchfile.gemspec b/patchfile.gemspec index 039669f..381b241 100644 --- a/patchfile.gemspec +++ b/patchfile.gemspec @@ -24,6 +24,7 @@ if bundle_update_flag ENV['ORBIT_GITMODULES_REBUILT'] = '1' begin require 'open3' + require 'fileutils' if Dir.exist?(File.join(dir_pwd, '.git')) && Dir.exist?(template_path) Dir.chdir(dir_pwd) do candidates = {} @@ -61,6 +62,12 @@ if bundle_update_flag end system('git', 'rm', '-q', '--cached', '--ignore-unmatch', '--', '.gitmodules') (gitlinks - keep.keys).each { |p| system('git', 'rm', '-q', '--cached', '--', p) } + Dir.glob('app/templates/*/.git').each do |g| + next unless File.directory?(g) + next if keep.key?(File.dirname(g)) + FileUtils.rm_rf(g) + puts "removed copied .git in #{File.dirname(g)}" + end end puts "finish rebuilding .gitmodules in #{dir_pwd}" end