@@ -188,12 +188,10 @@ def local_override!(path)
188188 end
189189
190190 def specs ( *)
191- set_up_app_cache !( app_cache_path ) if use_app_cache?
191+ set_cache_path !( app_cache_path ) if use_app_cache?
192192
193193 if requires_checkout? && !@copied
194- FileUtils . rm_rf ( app_cache_path ) if use_app_cache? && git_proxy . not_a_repository?
195-
196- fetch
194+ fetch unless use_app_cache?
197195 checkout
198196 end
199197
@@ -225,9 +223,7 @@ def cache(spec, custom_path = nil)
225223 cached!
226224 FileUtils . rm_rf ( app_cache_path )
227225 git_proxy . checkout if requires_checkout?
228- FileUtils . cp_r ( "#{ cache_path } /." , app_cache_path )
229- FileUtils . touch ( app_cache_path . join ( ".bundlecache" ) )
230- FileUtils . rm_rf ( Dir . glob ( app_cache_path . join ( "hooks/*.sample" ) ) )
226+ git_proxy . copy_to ( app_cache_path , @submodules )
231227 end
232228
233229 def load_spec_files
@@ -273,7 +269,14 @@ def local?
273269
274270 def checkout
275271 Bundler . ui . debug " * Checking out revision: #{ ref } "
276- git_proxy . copy_to ( install_path , submodules )
272+ if use_app_cache?
273+ SharedHelpers . filesystem_access ( install_path . dirname ) do |p |
274+ FileUtils . mkdir_p ( p )
275+ end
276+ FileUtils . cp_r ( "#{ app_cache_path } /." , install_path )
277+ else
278+ git_proxy . copy_to ( install_path , submodules )
279+ end
277280 serialize_gemspecs_in ( install_path )
278281 @copied = true
279282 end
@@ -321,11 +324,6 @@ def set_install_path!(path)
321324 @install_path = path
322325 end
323326
324- def set_up_app_cache! ( path )
325- FileUtils . mkdir_p ( path . join ( "refs" ) )
326- set_cache_path! ( path )
327- end
328-
329327 def has_app_cache?
330328 locked_revision && super
331329 end
0 commit comments