rstudio / renv

renv: Project environments for R.

Home Page:https://rstudio.github.io/renv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`renv_cache_init` assumes that the cache only consists of one path

vandenman opened this issue · comments

This part

renv/R/cache.R

Lines 24 to 31 in be4dc4e

cache <- renv_paths_cache()
ensure_directory(cache)
# if the cache appears to be within the project directory,
# then drop a '.renvignore' file within so it's not scanned
#
# https://github.com/rstudio/renv/issues/1655
if (renv_path_within(cache, getwd())) {

assumes that the cache consists of at most one path. If there are multiple caches then you get an error:

if (renv_path_within(cache, getwd())) {
  error: the condition has length > 1

Here is a proposed solution. I'd be happy to open a PR, but I also noticed that the unit tests for multiple caches are skipped:

# test_that("multiple cache directories are used", {

Is there a particular reason for skipping these tests? I'd be happy to figure out what goes on there and fix them.

Thanks -- I think d5b7e6a should resolve the issue you're seeing.

Is there a particular reason for skipping these tests? I'd be happy to figure out what goes on there and fix them.

I don't recall exactly why, but it appeared the tests were failing, and at the time I didn't have the bandwidth to investigate. That happened here:

cb15fc3

but if you'd be willing to revive those tests I would be grateful.