R/ignore.R

Defines functions git_ignore_path_is_ignored

Documented in git_ignore_path_is_ignored

#' Git Ignore
#'
#' Test if files would be ignored by `.gitignore` rules
#'
#' @export
#' @rdname git_ignore
#' @name git_ignore
#' @family git
#' @inheritParams git_open
#' @param path A character vector of paths to test within the repo
#' @return A logical vector the same length as `path`, indicating if the
#' paths would be ignored.
#' @useDynLib gert R_git_ignore_path_is_ignored
#' @git ignore
#' @seealso `usethis::use_git_ignore()` to add a path to `.gitignore`.
git_ignore_path_is_ignored <- function(path, repo = '.') {
  repo <- git_open(repo)
  path <- as.character(path)
  .Call(R_git_ignore_path_is_ignored, repo, path)
}

Try the gert package in your browser

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

gert documentation built on July 22, 2026, 5:07 p.m.