[rubygems/rubygems] Stop removing the `.git` folder from cached git gems

If we want to change git gems to use a proper cache, instead of using
the cache folder as the install location, so we need to keep git
information in the cache, so that when running `bundle install` or
`bundler install --local`, we are able to figure out whether the
revision that needs to be checked out is present locally in the cache or
needs to be fetched from the remote repository.

https://github.com/rubygems/rubygems/commit/607eda63eb
This commit is contained in:
David Rodríguez 2021-03-18 13:19:40 +01:00 коммит произвёл git
Родитель b1db07074b
Коммит a4ec5f8747
3 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -196,6 +196,7 @@ module Bundler
FileUtils.rm_rf(new_cache_path)
FileUtils.cp_r(install_path, new_cache_path)
FileUtils.rm_rf(app_cache_path.join(".git"))
FileUtils.touch(app_cache_path.join(".bundlecache"))
end

Просмотреть файл

@ -140,7 +140,6 @@ module Bundler
end
Dir[cache_path.join("*/.git")].each do |git_dir|
FileUtils.rm_rf(git_dir)
FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
end

2
spec/bundler/cache/git_spec.rb поставляемый
Просмотреть файл

@ -25,7 +25,6 @@ RSpec.describe "bundle cache with git" do
bundle "config set cache_all true"
bundle :cache
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
FileUtils.rm_rf lib_path("foo-1.0")
@ -47,7 +46,6 @@ RSpec.describe "bundle cache with git" do
bundle :cache
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
FileUtils.rm_rf lib_path("foo-1.0")
expect(the_bundle).to include_gems "foo 1.0"