Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

config: Add test for Windows local paths. #977

Merged
merged 1 commit into from
Oct 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
url = [email protected]:src-d/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*:refs/remotes/origin/pull/*
[remote "win-local"]
url = X:\\Git\\
[submodule "qux"]
path = qux
url = https://github.com/foo/qux.git
Expand All @@ -41,13 +43,15 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
c.Assert(cfg.Core.Worktree, Equals, "foo")
c.Assert(cfg.Core.CommentChar, Equals, "bar")
c.Assert(cfg.Pack.Window, Equals, uint(20))
c.Assert(cfg.Remotes, HasLen, 2)
c.Assert(cfg.Remotes, HasLen, 3)
c.Assert(cfg.Remotes["origin"].Name, Equals, "origin")
c.Assert(cfg.Remotes["origin"].URLs, DeepEquals, []string{"[email protected]:mcuadros/go-git.git"})
c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"})
c.Assert(cfg.Remotes["alt"].Name, Equals, "alt")
c.Assert(cfg.Remotes["alt"].URLs, DeepEquals, []string{"[email protected]:mcuadros/go-git.git", "[email protected]:src-d/go-git.git"})
c.Assert(cfg.Remotes["alt"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"})
c.Assert(cfg.Remotes["win-local"].Name, Equals, "win-local")
c.Assert(cfg.Remotes["win-local"].URLs, DeepEquals, []string{"X:\\Git\\"})
c.Assert(cfg.Submodules, HasLen, 1)
c.Assert(cfg.Submodules["qux"].Name, Equals, "qux")
c.Assert(cfg.Submodules["qux"].URL, Equals, "https://github.com/foo/qux.git")
Expand All @@ -69,6 +73,8 @@ func (s *ConfigSuite) TestMarshall(c *C) {
fetch = +refs/pull/*:refs/remotes/origin/pull/*
[remote "origin"]
url = [email protected]:mcuadros/go-git.git
[remote "win-local"]
url = "X:\\Git\\"
[submodule "qux"]
url = https://github.com/foo/qux.git
[branch "master"]
Expand All @@ -91,6 +97,11 @@ func (s *ConfigSuite) TestMarshall(c *C) {
Fetch: []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"},
}

cfg.Remotes["win-local"] = &RemoteConfig{
Name: "win-local",
URLs: []string{"X:\\Git\\"},
}

cfg.Submodules["qux"] = &Submodule{
Name: "qux",
URL: "https://github.com/foo/qux.git",
Expand Down Expand Up @@ -119,6 +130,8 @@ func (s *ConfigSuite) TestUnmarshallMarshall(c *C) {
url = [email protected]:mcuadros/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
mirror = true
[remote "win-local"]
url = "X:\\Git\\"
[branch "master"]
remote = origin
merge = refs/heads/master
Expand Down