Skip to content

load_all with specific git ref #2608

@r2evans

Description

@r2evans

Is your feature request related to a problem? Please describe.

At times I need to manually step through a regression and see what commit caused the change in behavior. When the condition is easily handled programmatically, then git-bisect is a great way to go, but sometimes it's more nuanced and benefits from "human inspection".

Describe the solution you'd like

devtools::load_all("path/to/mypackage", ref="23eeb01")

It feels (to me) like this is more than what remotes:: offers, since I'm looking for the same "current environment side-effect" that devtools::load_all() provides. I imagine it might benefit from git2r if present (fallback to shell git).

Describe alternatives you've considered

(1) I tried remotes::install_git(repo, ref), but it has the undesired side-effect of installing an older version into my R library. I could use a temporary library to do this, but (1) it's a little slower, and (2) it doesn't load the package the same way that load_all() does. Further, if I had already load_all()'d (from the filesystem alone, no ref) the package into my R session, I'm "looking" at the wrong version.

(2) I was able to get the effect I wanted by using git worktrees:

$ cd path/to/mypackage
$ git worktree add _23ee 23eeb01

and in R

devtools::load_all("path/to/mypackage/_23ee")

(A more-advanced extension of this functionality would enable in-R git bisecting, perhaps iterating over head(git2r::commits(repo)), running R code after each load_all(repo, ref). While that's out of scope for this FR, I think there is value-added to be able to do that "in R" at times, even if it is not the first-stop recommendation.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions