rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

option setting does not modify other options #656

Closed aronatkins closed 2 years ago

aronatkins commented 2 years ago

fixes #655

toph-allen commented 2 years ago

What I did

I smoke tested this and #654 in a merged branch.

I tested the changes by:

Specific to this change, I also ran the snippet of code from Aron's issue:

packrat::set_opts(ignored.packages = c("emo"), persist = FALSE)
packrat::opts$snapshot.recommended.packages(TRUE, persist = FALSE)
packrat::get_opts(c("ignored.packages"))

Results

The code snippet from Aron's issue performed as expected.

reconnect::writeManifest() correctly ignored packages. Previously, because of option-modification that package was performing, Packrat settings were lost, so the correct behavior indicates the change is working as expected.

I noticed that GitHub-related fields are present on all packages when any GitHub package is present in the list. I'm sure this is expected behavior — just mentioning it here in the interest of completeness. The fields

      "GithubRepo": null,
      "GithubUsername": null,
      "GithubRef": null,
      "GithubSha1": null,

were present on all packages with packrat.set_opts(ignored.packages = ""), and with packrat.set_opts(ignored.packages = c("Rcpp", "stringr"), but absent with packrat.set_opts(ignored.packages = c("emo", "Rcpp", "stringr") (These checks were performed with a build from this branch alone, not from the combined branch.

aronatkins commented 2 years ago

The GitHub fields are probably a result of using a data frame to record all the dependencies; once one record requires a field, they all receive that value.

@toph-allen - Could you file an rsconnect issue to track the presence of those null-value fiends? They're harmless, but maybe worth trimming.

toph-allen commented 2 years ago

That makes total sense as to the cause.

I'll add it to my list of issues to file :)

[Edit] I'll just file a quick issue now.