getGitRoot: Are we in a 'git' repository?

Description Usage Arguments Value Author(s) Examples

View source: R/inGit.R

Description

The getGitRoot() function recursively ascends the filesystem tree from the given directory until it either finds a directory .git, or the top-level directory to abort the search. The root directory of the git repository is returned, with an exmpty string in the case of no repository. The inGit() function turns this into boolean predicate returning either TRUE or FALSE.

Usage

1
2
3
getGitRoot(cwd = getwd())

inGit(cwd = getwd())

Arguments

cwd

The start directory, default to the current working directory

Value

For getGitRoot(), the path of the directory containing the .git directory, ie the project root directory, or an empty string in case the search started outside a git directory. The inGit() function returns a boolean as to whether a git repository was found or not.

Author(s)

Dirk Eddelbuettel

Examples

1

dang documentation built on Oct. 30, 2021, 1:08 a.m.