check_git_clean <- function(repo) {
if (!git_clean(repo)) {
stop("Repository ", git2r::workdir(repo), " is not clean.", call. = FALSE)
}
}
git_clean <- function(repo, kind = 1:3) {
length(unlist(git2r::status(repo)[kind])) == 0L
}
dirty_commit <- function(repo, msg) {
if (!git_clean(repo, kind = "staged")) {
git2r::commit(repo, msg)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.