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

Commit c2ba07b

Browse files
committed
Add test for Windows local paths.
Signed-off-by: Filip Navara <navara@emclient.com>
1 parent c2ab4ac commit c2ba07b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

config/config_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
2424
url = git@github.com:src-d/go-git.git
2525
fetch = +refs/heads/*:refs/remotes/origin/*
2626
fetch = +refs/pull/*:refs/remotes/origin/pull/*
27+
[remote "win-local"]
28+
url = X:\\Git\\
2729
[submodule "qux"]
2830
path = qux
2931
url = https://github.com/foo/qux.git
@@ -41,13 +43,15 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
4143
c.Assert(cfg.Core.Worktree, Equals, "foo")
4244
c.Assert(cfg.Core.CommentChar, Equals, "bar")
4345
c.Assert(cfg.Pack.Window, Equals, uint(20))
44-
c.Assert(cfg.Remotes, HasLen, 2)
46+
c.Assert(cfg.Remotes, HasLen, 3)
4547
c.Assert(cfg.Remotes["origin"].Name, Equals, "origin")
4648
c.Assert(cfg.Remotes["origin"].URLs, DeepEquals, []string{"git@github.com:mcuadros/go-git.git"})
4749
c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"})
4850
c.Assert(cfg.Remotes["alt"].Name, Equals, "alt")
4951
c.Assert(cfg.Remotes["alt"].URLs, DeepEquals, []string{"git@github.com:mcuadros/go-git.git", "git@github.com:src-d/go-git.git"})
5052
c.Assert(cfg.Remotes["alt"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"})
53+
c.Assert(cfg.Remotes["win-local"].Name, Equals, "win-local")
54+
c.Assert(cfg.Remotes["win-local"].URLs, DeepEquals, []string{"X:\\Git\\"})
5155
c.Assert(cfg.Submodules, HasLen, 1)
5256
c.Assert(cfg.Submodules["qux"].Name, Equals, "qux")
5357
c.Assert(cfg.Submodules["qux"].URL, Equals, "https://github.com/foo/qux.git")
@@ -69,6 +73,8 @@ func (s *ConfigSuite) TestMarshall(c *C) {
6973
fetch = +refs/pull/*:refs/remotes/origin/pull/*
7074
[remote "origin"]
7175
url = git@github.com:mcuadros/go-git.git
76+
[remote "win-local"]
77+
url = "X:\\Git\\"
7278
[submodule "qux"]
7379
url = https://github.com/foo/qux.git
7480
[branch "master"]
@@ -91,6 +97,11 @@ func (s *ConfigSuite) TestMarshall(c *C) {
9197
Fetch: []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"},
9298
}
9399

100+
cfg.Remotes["win-local"] = &RemoteConfig{
101+
Name: "win-local",
102+
URLs: []string{"X:\\Git\\"},
103+
}
104+
94105
cfg.Submodules["qux"] = &Submodule{
95106
Name: "qux",
96107
URL: "https://github.com/foo/qux.git",
@@ -119,6 +130,8 @@ func (s *ConfigSuite) TestUnmarshallMarshall(c *C) {
119130
url = git@github.com:mcuadros/go-git.git
120131
fetch = +refs/heads/*:refs/remotes/origin/*
121132
mirror = true
133+
[remote "win-local"]
134+
url = "X:\\Git\\"
122135
[branch "master"]
123136
remote = origin
124137
merge = refs/heads/master

0 commit comments

Comments
 (0)