aboutsummaryrefslogtreecommitdiffstats
path: root/config/config_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-13 23:38:57 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-02-13 23:38:57 +0100
commitf8b5557875513c5b0aff24bb7b8e28f8f680976f (patch)
tree56ae4d1b2cde8644216c594e6913b9c6f763cd8b /config/config_test.go
parent940a16ca68457beded1eff551f23febeffb32f3e (diff)
downloadgo-git-f8b5557875513c5b0aff24bb7b8e28f8f680976f.tar.gz
config: adding Config.Core.Worktree
Diffstat (limited to 'config/config_test.go')
-rw-r--r--config/config_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/config/config_test.go b/config/config_test.go
index 2bcefe4..313c96c 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -9,6 +9,7 @@ var _ = Suite(&ConfigSuite{})
func (s *ConfigSuite) TestUnmarshall(c *C) {
input := []byte(`[core]
bare = true
+ worktree = foo
[remote "origin"]
url = git@github.com:mcuadros/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
@@ -22,15 +23,39 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
c.Assert(err, IsNil)
c.Assert(cfg.Core.IsBare, Equals, true)
+ c.Assert(cfg.Core.Worktree, Equals, "foo")
c.Assert(cfg.Remotes, HasLen, 1)
c.Assert(cfg.Remotes["origin"].Name, Equals, "origin")
c.Assert(cfg.Remotes["origin"].URL, Equals, "git@github.com:mcuadros/go-git.git")
c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"})
}
+func (s *ConfigSuite) TestMarshall(c *C) {
+ output := []byte(`[core]
+ bare = true
+ worktree = bar
+[remote "origin"]
+ url = git@github.com:mcuadros/go-git.git
+`)
+
+ cfg := NewConfig()
+ cfg.Core.IsBare = true
+ cfg.Core.Worktree = "bar"
+ cfg.Remotes["origin"] = &RemoteConfig{
+ Name: "origin",
+ URL: "git@github.com:mcuadros/go-git.git",
+ }
+
+ b, err := cfg.Marshal()
+ c.Assert(err, IsNil)
+
+ c.Assert(string(b), Equals, string(output))
+}
+
func (s *ConfigSuite) TestUnmarshallMarshall(c *C) {
input := []byte(`[core]
bare = true
+ worktree = foo
custom = ignored
[remote "origin"]
url = git@github.com:mcuadros/go-git.git