dflow
dflow copied to clipboard
`r_make()` fails if a git repo isn't created with an rmd file
When I add the rmarkdown file with use_rmd(), when running drake::r_make(), I get this error:
Quitting from lines 34-42 (analysis.Rmd)
\
x fail target_name
Error : target target_name failed.
diagnose(target_name)error$message:
The 'path' is not in a git repository
diagnose(target_name)error$calls:
1. └─git2r::repository()
2. └─base::stop("The 'path' is not in a git repository")
In addition: Warning message:
Missing files for target target_name:
docs/analysis.html
Error: callr subprocess failed: target target_name failed.
diagnose(target_name)error$message:
The 'path' is not in a git repository
diagnose(target_name)error$calls:
1. └─git2r::repository()
2. └─base::stop("The 'path' is not in a git repository")
Since it is trying to find a git repo.
I'm not sure if this is intentional or not - like maybe you want it to always set up a git repo?
But this line of code should help avoid the error:
## repository
if (!is.null(git2r::discover_repository())) {
git2r::repository()
}