getGitRoot | R Documentation |
git
repository?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
.
getGitRoot(cwd = getwd())
inGit(cwd = getwd())
cwd |
The start directory, default to the current working directory |
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.
Dirk Eddelbuettel
inGit()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.