Skip to content

Commit d055526

Browse files
committed
Be able to work with global (user-level) git config outside a git repo
1 parent d18d3fa commit d055526

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/git-utils.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ git_config_get <- function(name, global = FALSE) {
345345
git_config_set <- function(name, value, global = FALSE) {
346346
old <- git_config_get(name, global = global)
347347

348-
config <- list(git_repo(), value, global)
348+
repo <- if (uses_git()) git_repo() else NULL
349+
config <- list(repo, value, global)
349350
names(config) <- c("repo", name, "global")
350351
do.call(git2r::config, config)
351352

0 commit comments

Comments
 (0)