Open
Description
If the .git/config
file has an empty subsection name like this:
[remote ""]
url = "foo"
fetch = "bar"
The official git implementation works fine, but go-git fails to parse the config with an error that says "empty subsection name".
Found out while using go-git at work to analyze git repos.
I'd be happy to send a patch to make go-git behave the same as git.
Minimal reproduction:
package main
import "github.com/go-git/go-git/v5"
func must(err error) {
if err != nil {
panic(err)
}
}
func main() {
// somerepo/.git/config should have an empty toml subsection.
repo, err := git.PlainOpen("./somerepo")
must(err)
remotes, err := repo.Remotes()
must(err) // panics here
for _, remote := range remotes {
println(remote.Config().Name)
}