summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Colson <danieljamescolson@gmail.com>2024-09-06 13:10:04 -0400
committergit <svn-admin@ruby-lang.org>2024-09-09 11:59:52 +0000
commit966901b39dd7b37eec68dd6e8a76a79827dc522f (patch)
tree32d0633c9cdeaaf92aed13c0c7c774033abd5595
parent3aae0873f71098946fa06d8428205762a26e1f27 (diff)
[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
-rw-r--r--lib/bundler/source/git.rb1
-rw-r--r--spec/bundler/cache/git_spec.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 4e94645f6b..2a327e5fb6 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -226,6 +226,7 @@ module Bundler
git_proxy.checkout if requires_checkout?
FileUtils.cp_r("#{cache_path}/.", app_cache_path)
FileUtils.touch(app_cache_path.join(".bundlecache"))
+ FileUtils.rm_rf(Dir.glob(app_cache_path.join("hooks/*.sample")))
end
def load_spec_files
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 8958916fec..7c577b105e 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/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}/.git")).not_to exist
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")
expect(the_bundle).to include_gems "foo 1.0"