R/local_repo_branch.R

Defines functions local_repo_branch

Documented in local_repo_branch

#' @rdname local_repo
#' @export
local_repo_branch = function(repo_dir, branch) {
  require_gert()
  arg_is_chr(repo_dir)
  arg_is_chr_scalar(branch)

  repo_dir = repo_dir_helper(repo_dir)

  res = purrr::map(
    repo_dir,
    function(dir) {
      res = purrr::safely(gert::git_branch_create)(
        name = branch, repo = dir
      )

      repo = fs::path_file(dir)
      status_msg(
        res,
        "Added branch {.val {branch}} to {.val {repo}}.",
        "Failed to add branch {.val {branch}} to {.val {repo}}."
      )

      res
    }
  )

  invisible(res)
}

Try the ghclass package in your browser

Any scripts or data that you put into this service are public.

ghclass documentation built on May 29, 2024, 8:44 a.m.