def clone(remote, opts = {})
logger.debug1 { "Cloning '#{remote}' into #{@path}" }
set_cache(remote)
@cache_repo.sync
objectpath = (@cache_repo.git_dir + 'objects').to_s
::Rugged::Repository.init_at(@path.to_s, false)
@_rugged_repo = ::Rugged::Repository.new(@path.to_s, :alternates => [objectpath])
alternates << objectpath
with_repo do |repo|
config = repo.config
config['remote.origin.url'] = remote
config['remote.origin.fetch'] = '+refs/heads/*:refs/remotes/origin/*'
config['remote.cache.url'] = @cache_repo.git_dir.to_s
config['remote.cache.fetch'] = '+refs/heads/*:refs/remotes/cache/*'
end
checkout(opts.fetch(:ref, 'HEAD'))
end