[rubygems/rubygems] Regeneration previous git application caches that didn't include bare repos
https://github.com/rubygems/rubygems/commit/417319ecb1
This commit is contained in:
parent
7845ab1bc9
commit
54b6025887
@ -188,9 +188,11 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def specs(*)
|
def specs(*)
|
||||||
set_cache_path!(app_cache_path) if has_app_cache? && !local?
|
set_cache_path!(app_cache_path) if use_app_cache?
|
||||||
|
|
||||||
if requires_checkout? && !@copied
|
if requires_checkout? && !@copied
|
||||||
|
FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository?
|
||||||
|
|
||||||
fetch
|
fetch
|
||||||
checkout
|
checkout
|
||||||
end
|
end
|
||||||
@ -321,6 +323,10 @@ module Bundler
|
|||||||
cached_revision && super
|
cached_revision && super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def use_app_cache?
|
||||||
|
has_app_cache? && !local?
|
||||||
|
end
|
||||||
|
|
||||||
def requires_checkout?
|
def requires_checkout?
|
||||||
allow_git_ops? && !local? && !cached_revision_checked_out?
|
allow_git_ops? && !local? && !cached_revision_checked_out?
|
||||||
end
|
end
|
||||||
|
@ -84,6 +84,10 @@ module Bundler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def not_a_bare_repository?
|
||||||
|
git_local("rev-parse", "--is-bare-repository", dir: path).strip == "false"
|
||||||
|
end
|
||||||
|
|
||||||
def contains?(commit)
|
def contains?(commit)
|
||||||
allowed_with_path do
|
allowed_with_path do
|
||||||
result, status = git_null("branch", "--contains", commit, dir: path)
|
result, status = git_null("branch", "--contains", commit, dir: path)
|
||||||
|
40
spec/bundler/cache/git_spec.rb
vendored
40
spec/bundler/cache/git_spec.rb
vendored
@ -258,6 +258,46 @@ RSpec.describe "bundle cache with git" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "can install after bundle cache generated with an older Bundler that kept checkouts in the cache" do
|
||||||
|
git = build_git("foo")
|
||||||
|
locked_revision = git.ref_for("main")
|
||||||
|
path_revision = git.ref_for("main", 11)
|
||||||
|
|
||||||
|
git_path = lib_path("foo-1.0")
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "https://gem.repo1"
|
||||||
|
gem "foo", :git => '#{git_path}'
|
||||||
|
G
|
||||||
|
lockfile <<~L
|
||||||
|
GIT
|
||||||
|
remote: #{git_path}/
|
||||||
|
revision: #{locked_revision}
|
||||||
|
specs:
|
||||||
|
foo (1.0)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo1/
|
||||||
|
specs:
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
foo!
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
# Simulate an old incorrect situation where vendor/cache would be the install location of git gems
|
||||||
|
FileUtils.mkdir_p bundled_app("vendor/cache")
|
||||||
|
FileUtils.cp_r git_path, bundled_app("vendor/cache/foo-1.0-#{path_revision}")
|
||||||
|
FileUtils.rm_rf bundled_app("vendor/cache/foo-1.0-#{path_revision}/.git")
|
||||||
|
|
||||||
|
bundle :install, env: { "BUNDLE_DEPLOYMENT" => "true", "BUNDLE_CACHE_ALL" => "true" }
|
||||||
|
end
|
||||||
|
|
||||||
it "respects the --no-install flag" do
|
it "respects the --no-install flag" do
|
||||||
git = build_git "foo", &:add_c_extension
|
git = build_git "foo", &:add_c_extension
|
||||||
ref = git.ref_for("main", 11)
|
ref = git.ref_for("main", 11)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user