File: check-git.R

package info (click to toggle)
r-cran-devtools 2.4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,340 kB
  • sloc: sh: 15; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#' Git checks.
#'
#' This function performs Git checks checks prior to release. It is called
#' automatically by [release()].
#'
#' @template devtools
#' @keywords internal
git_checks <- function(pkg = ".") {
  pkg <- as.package(pkg)
  cat_rule(paste0("Running Git checks for ", pkg$package))

  git_report_branch(pkg)
  git_check_uncommitted(pkg)
  cat_rule()
}

git_report_branch <- function(pkg) {
  cat("Current branch:", git_branch(pkg$path), "\n")
}

git_check_uncommitted <- function(pkg) {
  check_status(
    !git_uncommitted(pkg$path),
    "uncommitted files",
    "All files should be tracked and committed before release. Please add and commit."
  )
}