Skip to content

Commit

Permalink
fix: solve issue when detecting git branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Oct 22, 2023
1 parent ab49d25 commit cc9e853
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions R/utils-gh.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,28 @@ get_git_branch_name <- function() {

config <- as.data.frame(gert::git_config_global())

default_branch <- config[which(config$"name" == "init.defaultbranch"),
default_global <- config[which(config$"name" == "init.defaultbranch" &
config$"level" == "global"),
"value"]

if (length(default_branch) == 0) {

current_branch <- "master"
if (length(default_global) == 1) {

current_branch <- default_global

} else {

current_branch <- default_branch
default_system <- config[which(config$"name" == "init.defaultbranch" &
config$"level" == "system"),
"value"]

if (length(default_system) == 0) {

current_branch <- "master"

} else {

current_branch <- default_system
}
}
}

Expand Down

0 comments on commit cc9e853

Please sign in to comment.