R/git.R

Defines functions renv_git_root renv_git_preflight

renv_git_preflight <- function() {
  if (!nzchar(Sys.which("git")))
    stopf("'git' is not available on the PATH")
}

renv_git_root <- function(project) {

  project <- normalizePath(project, winslash = "/", mustWork = FALSE)
  renv_file_find(project, function(parent) {
    gitroot <- file.path(parent, ".git")
    if (file.exists(gitroot))
      return(gitroot)
  })

}
wnattt/renv documentation built on Dec. 23, 2021, 5:19 p.m.