diff options
author | Daniel Colson <[email protected]> | 2024-09-19 14:48:57 -0400 |
---|---|---|
committer | git <[email protected]> | 2024-09-23 10:49:21 +0000 |
commit | d0925c075b5c9de9702adf1949f77faf8fbfc3b8 (patch) | |
tree | 03f189b02b9caa56e5584ba29957aa73c5de7534 /lib/bundler/source | |
parent | c071fedb320d8e7c9edc3087a3386895d59c6100 (diff) |
[rubygems/rubygems] Ensure refs directory in cached git source
See https://github.com/rubygems/rubygems/issues/8046 for details
Prior to this commit a cached git source without a specific ref wouldn't
survive pushing to a remote and then pulling on a different machine.
We'd end up without a refs directory in the cache, at which point git
won't recognize it as a repo.
This commit fixes the problem by adding a refs directory if it's not
already there. This needs to be done as early as possible, so any git
commands will work as expected, so this commit adds it before creating
the app cached git proxy.
https://github.com/rubygems/rubygems/commit/8c89f0b065
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/git.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index c52ce04638..78f9ff0560 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -188,7 +188,7 @@ module Bundler end def specs(*) - set_cache_path!(app_cache_path) if use_app_cache? + set_up_app_cache!(app_cache_path) if use_app_cache? if requires_checkout? && !@copied FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository? @@ -320,6 +320,11 @@ module Bundler @install_path = path end + def set_up_app_cache!(path) + FileUtils.mkdir_p(path.join("refs")) + set_cache_path!(path) + end + def has_app_cache? cached_revision && super end |