Learn R Programming

pensar (version 0.4.2)

vault_commit: Vault git operations

Description

Auto-commit and push for pensar vaults that are git repos. Commit vault changes to git

No-op if the vault is not a git repo or if there are no changes. Stages all changes (respecting .gitignore), commits with the given message, and optionally pushes to remotes.

Honors the PENSAR_AUTO_PUSH environment variable: if set to "0" or "false" (case-insensitive), skips the push step. Otherwise, pushes to every configured remote.

Usage

vault_commit(message, vault = default_vault(), push = NULL)

Value

TRUE if a commit was made, FALSE otherwise (invisibly).

Arguments

message

Commit message.

vault

Path to the vault directory.

push

If NULL (default), honors PENSAR_AUTO_PUSH. Pass TRUE or FALSE to override.

Examples

Run this code
v <- tempfile("vault-")
init_vault(v, rproj = FALSE, agent_instructions = FALSE)
# Returns FALSE invisibly: no .git in this temp vault.
vault_commit("noop", vault = v, push = FALSE)
unlink(v, recursive = TRUE)

Run the code above in your browser using DataLab