[rubygems/rubygems] Keep only the bare clone in the per app cache

We don't need an actual checkout since the cache path is no longer used
as the install location. Now the per app cache acts just like the
standard cache.

https://github.com/rubygems/rubygems/commit/686988923c
This commit is contained in:
David Rodríguez 2021-03-17 17:41:25 +01:00 коммит произвёл git
Родитель b50606c45a
Коммит 4b44590d39
3 изменённых файлов: 5 добавлений и 7 удалений

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

@ -139,10 +139,6 @@ module Bundler
spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
end
Dir[cache_path.join("*/.git")].each do |git_dir|
FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
end
prune_cache(cache_path) unless Bundler.settings[:no_prune]
end

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

@ -222,7 +222,8 @@ module Bundler
cached!
FileUtils.rm_rf(app_cache_path)
git_proxy.checkout if requires_checkout?
git_proxy.copy_to(app_cache_path, @submodules)
FileUtils.cp_r("#{cache_path}/.", app_cache_path)
FileUtils.touch(app_cache_path.join(".bundlecache"))
end
def load_spec_files

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

@ -25,6 +25,7 @@ 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")
@ -46,6 +47,7 @@ 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"
@ -209,7 +211,7 @@ RSpec.describe "bundle cache with git" do
expect(the_bundle).to include_gem "foo 1.0"
end
it "copies repository to vendor cache, including submodules" do
it "copies repository to vendor cache" do
# CVE-2022-39253: https://lore.kernel.org/lkml/xmqq4jw1uku5.fsf@gitster.g/
system(*%W[git config --global protocol.file.allow always])
@ -234,7 +236,6 @@ RSpec.describe "bundle cache with git" do
bundle :cache
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist
expect(the_bundle).to include_gems "has_submodule 1.0"
end