diff --git a/_examples/push/main.go b/_examples/push/main.go index 240a5fedf..01eceaebf 100644 --- a/_examples/push/main.go +++ b/_examples/push/main.go @@ -16,6 +16,7 @@ func main() { r, err := git.PlainOpen(path) CheckIfError(err) + Info("git push") // push using default options err = r.Push(&git.PushOptions{}) CheckIfError(err) diff --git a/config/config_test.go b/config/config_test.go index 7e9483f6f..6f011e012 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -371,3 +371,27 @@ func (s *ConfigSuite) TestRemoveUrlOptions(c *C) { } c.Assert(err, IsNil) } + +func (s *ConfigSuite) TestUnmarshalRemotes(c *C) { + input := []byte(`[core] + bare = true + worktree = foo + custom = ignored +[user] + name = John Doe + email = john@example.com +[remote "origin"] + url = https://git.sr.ht/~mcepl/go-git + pushurl = git@git.sr.ht:~mcepl/go-git.git + fetch = +refs/heads/*:refs/remotes/origin/* + mirror = true +`) + + cfg := NewConfig() + err := cfg.Unmarshal(input) + c.Assert(err, IsNil) + + c.Assert(cfg.Remotes["origin"].URLs[0], Equals, "https://git.sr.ht/~mcepl/go-git") + c.Assert(cfg.Remotes["origin"].URLs[1], Equals, "git@git.sr.ht:~mcepl/go-git.git") +} +