class Bundler::Source::Git

def cache(spec, custom_path = nil)

def cache(spec, custom_path = nil)
  app_cache_path = app_cache_path(custom_path)
  return unless Bundler.feature_flag.cache_all?
  return if install_path == app_cache_path
  return if cache_path == app_cache_path
  cached!
  FileUtils.rm_rf(app_cache_path)
  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