[rubygems/rubygems] Don't include hook templates in cached git source

With a default git setup, each cloned repo in the cache will end up with
~60K of sample git hooks. These files all end in `.sample`, and they are
disabled by default. Deleting them should be a no-op, and makes the
cache a bit smaller.

https://github.com/rubygems/rubygems/commit/d2149999cd
This commit is contained in:
Daniel Colson 2024-09-06 13:10:04 -04:00 коммит произвёл git
Родитель 3aae0873f7
Коммит 966901b39d
2 изменённых файлов: 2 добавлений и 0 удалений

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

@ -226,6 +226,7 @@ module Bundler
git_proxy.checkout if requires_checkout? git_proxy.checkout if requires_checkout?
FileUtils.cp_r("#{cache_path}/.", app_cache_path) FileUtils.cp_r("#{cache_path}/.", app_cache_path)
FileUtils.touch(app_cache_path.join(".bundlecache")) FileUtils.touch(app_cache_path.join(".bundlecache"))
FileUtils.rm_rf(Dir.glob(app_cache_path.join("hooks/*.sample")))
end end
def load_spec_files def load_spec_files

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

@ -27,6 +27,7 @@ RSpec.describe "bundle cache with git" do
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist 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}/.git")).not_to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
expect(Dir.glob(bundled_app("vendor/cache/foo-1.0-#{ref}/hooks/*.sample"))).to be_empty
FileUtils.rm_rf lib_path("foo-1.0") FileUtils.rm_rf lib_path("foo-1.0")
expect(the_bundle).to include_gems "foo 1.0" expect(the_bundle).to include_gems "foo 1.0"