File: 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 (16 lines) | stat: -rw-r--r-- 383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
uses_git <- function(path = ".") {
  dir_exists(path(path, ".git"))
}

git_branch <- function(path = ".") {
  withr::local_dir(path)

  system2("git", c("rev-parse", "--abbrev-ref", "HEAD"), stdout = TRUE)
}

git_uncommitted <- function(path = ".") {
  withr::local_dir(path)

  out <- system2("git", c("status", "--porcelain=v1"), stdout = TRUE)
  length(out) > 0
}