-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cache_prune()
and friends for board_url()
#734
Conversation
pins <- fs::dir_ls(cache_boards(), type = "directory") | ||
versions <- fs::dir_ls(pins, type = "directory") | ||
|
||
versions <- fs::dir_ls(cache_boards(), recurse = 2, type = "directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why this behaves differently? I wouldn't have expected this code to give a different result, so something about my understanding of dir_ls()
is flawed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's that recurse = 2
goes down 2 levels and the old code just went down one:
fs::dir_ls(type = "directory")
#> R blog inst man revdep tests tools vignettes
fs::dir_ls(type = "directory", recurse = 1)
#> R blog blog/pins-0-2-0 blog/pins-0-3-0
#> blog/pins-0-4-0 inst inst/preview inst/secret
#> man man/figures revdep tests
#> tests/testthat tools vignettes vignettes/articles
fs::dir_ls(type = "directory", recurse = 2)
#> R blog
#> blog/pins-0-2-0 blog/pins-0-2-0/images
#> blog/pins-0-3-0 blog/pins-0-3-0/images
#> blog/pins-0-4-0 blog/pins-0-4-0/images
#> inst inst/preview
#> inst/preview/highlight.js-9.15.9 inst/preview/pagedtable-1.1
#> inst/secret man
#> man/figures revdep
#> tests tests/testthat
#> tests/testthat/_snaps tests/testthat/datatxt
#> tests/testthat/files tests/testthat/pin-board
#> tests/testthat/pin-files tests/testthat/pin-rds
#> tools vignettes
#> vignettes/articles
Created on 2023-04-19 with reprex v2.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, duh.
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
Fixes #607
This PR recurses just a little in the board caches to find all the possible pin version directories, including the
board_url()
ones. Unlike now, whenpins:::cache_old()
does not findboard_url()
caches, with this PR we can:Created on 2023-04-18 with reprex v2.0.2
Interactively, I can now say "Yes" and then the pruning works. 👍
Unless I am mistaken, I don't think we are testing this caching code anywhere in the package. Let's consider how we might test that in a separate issue/PR and only focus on fixing this bug here.