You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just found this package and was very excited, unfortunately I haven't been able to get it to work yet. I've troubleshot a few of the stumbling blocks to getting fledge::bump_version() to work but this one seems to be impassable.
In bump-version.Rget_main_branch_config() (line 98) relies on the test length(local) (line 103). Dataframes, tibbles, and data.tables all return their number of columns for length(), even if they are empty. This causes get_main_branch_config() to spuriously return init[init$level == "local", ]$value (line 104) instead of init[init$level == "global"]$value (line 108)
Below is a redacted sample of my exact data to demonstrate
# object 'config' as would be retrieved by gert::git_config(repo)config<-structure(list(name= c("diff.astextplain.textconv", "filter.lfs.clean",
"filter.lfs.smudge", "filter.lfs.process", "filter.lfs.required",
"http.sslbackend", "http.sslcainfo", "core.autocrlf", "core.fscache",
"core.symlinks", "pull.rebase", "credential.helper", "credential.https://dev.azure.com.usehttppath",
"core.editor", "core.excludesfile", "gui.recentrepo", "user.email",
"user.name", "init.defaultbranch", "core.repositoryformatversion",
"core.filemode", "core.bare", "core.logallrefupdates", "core.symlinks",
"core.ignorecase", "remote.origin.url", "remote.origin.fetch",
"branch.main.remote", "branch.main.merge"), value= c("astextplain",
"git-lfs clean -- %f", "git-lfs smudge -- %f", "git-lfs filter-process",
"true", "openssl", "C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt",
"true", "true", "false", "false", "manager-core", "true", "\"C:\\Users\\Foo\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" --wait",
"C:/Users/Foo/.gitignore", "C:/foo/bar/baz/foobar",
"foo@bar.baz", "Foo Bar", "main", "0", "false",
"false", "true", "false", "true", "http://giteahere:3000/Foo/Bar.git",
"+refs/heads/*:refs/remotes/origin/*", "origin", "refs/heads/main"
), level= c("system", "system", "system", "system", "system",
"system", "system", "system", "system", "system", "system", "system",
"system", "global", "global", "global", "global", "global", "global",
"local", "local", "local", "local", "local", "local", "local",
"local", "local", "local")), row.names= c(NA, 29L), class= c("tbl_df",
"tbl", "data.frame"))
# contents of get_main_branch_config() configured to run interactivelyinit<-config[config$name=="init.defaultbranch", ]
print(init)
# A tibble: 1 × 3# name value level # <chr> <chr> <chr> #1 init.defaultbranch main globallocal<-init[init$level=="local", ]
print(local)
# A tibble: 0 × 3# ℹ 3 variables: name <chr>, value <chr>, level <chr>if (length(local)) { # this test fails because length(local)==3, _nrow(local)_==0
print(local$value) # the function prematurely ends, returning an empty table here
} else {
global<-init[init$level=="global"] # this is missing a comma and would also break
print(global$value)
}
If you want to stick with base R this is what I would suggest:
get_main_branch_config<-function(repo) {
#retrieve config of repo, filter down to init.defaultbranch valuesconfig<-gert::git_config(repo)
init<-config[config$name=="init.defaultbranch", ]
#return local default branch if it exists, otherwise default to globalif("local"%in%init$level){
return(init[init$level=="local",]$value)
} else {
return(init[init$level=="global",]$value)
}
}
You could also just get rid of this function entirely.
I just found this package and was very excited, unfortunately I haven't been able to get it to work yet. I've troubleshot a few of the stumbling blocks to getting
fledge::bump_version()
to work but this one seems to be impassable.In bump-version.R
get_main_branch_config()
(line 98) relies on the testlength(local)
(line 103). Dataframes, tibbles, and data.tables all return their number of columns forlength()
, even if they are empty. This causesget_main_branch_config()
to spuriously returninit[init$level == "local", ]$value
(line 104) instead ofinit[init$level == "global"]$value
(line 108)Below is a redacted sample of my exact data to demonstrate
If you want to stick with base R this is what I would suggest:
You could also just get rid of this function entirely.
The text was updated successfully, but these errors were encountered: