gert
gert copied to clipboard
git remote info errors when no upstream branch set
In the directory of a repo with a remote but in which no upstream branch has been set:
readLines ("./.git/config")
#> [1] "[core]"
#> [2] "\trepositoryformatversion = 0"
#> [3] "\tfilemode = true"
#> [4] "\tbare = false"
#> [5] "\tlogallrefupdates = true"
#> [6] "[remote \"origin\"]"
#> [7] "\turl = https://github.com/<org>/<repo>"
#> [8] "\tfetch = +refs/heads/*:refs/remotes/origin/*"
library (gert)
git_remote_info ()
#> Error in libgit2::git_remote_lookup: remote 'NA' does not exist
Created on 2021-03-02 by the reprex package (v1.0.0)
Lots of places that could be addressed, but ultimately happens here:
https://github.com/r-lib/gert/blob/a04c93acba37896a61b24a8c30f2030dc80922ba/src/files.c#L44-L47
gir_branch_remote_name can still be called without an upstream branch, straight from the repo reference, right?. Not a big deal, but a way to avoid that unhelpful error message would be good.