aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/file
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport/file')
-rw-r--r--plumbing/transport/file/client_test.go7
-rw-r--r--plumbing/transport/file/server.go4
-rw-r--r--plumbing/transport/file/server_test.go5
-rw-r--r--plumbing/transport/file/upload_pack_test.go12
4 files changed, 11 insertions, 17 deletions
diff --git a/plumbing/transport/file/client_test.go b/plumbing/transport/file/client_test.go
index 220df3d..030175e 100644
--- a/plumbing/transport/file/client_test.go
+++ b/plumbing/transport/file/client_test.go
@@ -1,9 +1,9 @@
package file
import (
- "fmt"
"io"
"os"
+ "path/filepath"
"strings"
"testing"
@@ -20,13 +20,12 @@ filemode = true
bare = true`
func prepareRepo(c *C, path string) transport.Endpoint {
- url := fmt.Sprintf("file://%s", path)
- ep, err := transport.NewEndpoint(url)
+ ep, err := transport.NewEndpoint(path)
c.Assert(err, IsNil)
// git-receive-pack refuses to update refs/heads/master on non-bare repo
// so we ensure bare repo config.
- config := fmt.Sprintf("%s/config", path)
+ config := filepath.Join(path, "config")
if _, err := os.Stat(config); err == nil {
f, err := os.OpenFile(config, os.O_TRUNC|os.O_WRONLY, 0)
c.Assert(err, IsNil)
diff --git a/plumbing/transport/file/server.go b/plumbing/transport/file/server.go
index 74085c2..61dd42d 100644
--- a/plumbing/transport/file/server.go
+++ b/plumbing/transport/file/server.go
@@ -14,7 +14,7 @@ import (
// and error. This is meant to be used when implementing a git-upload-pack
// command.
func ServeUploadPack(path string) error {
- ep, err := transport.NewEndpoint(fmt.Sprintf("file://%s", path))
+ ep, err := transport.NewEndpoint(path)
if err != nil {
return err
}
@@ -32,7 +32,7 @@ func ServeUploadPack(path string) error {
// input and error. This is meant to be used when implementing a
// git-receive-pack command.
func ServeReceivePack(path string) error {
- ep, err := transport.NewEndpoint(fmt.Sprintf("file://%s", path))
+ ep, err := transport.NewEndpoint(path)
if err != nil {
return err
}
diff --git a/plumbing/transport/file/server_test.go b/plumbing/transport/file/server_test.go
index a7b4e34..176d6ee 100644
--- a/plumbing/transport/file/server_test.go
+++ b/plumbing/transport/file/server_test.go
@@ -1,7 +1,6 @@
package file
import (
- "fmt"
"os"
"os/exec"
@@ -15,7 +14,6 @@ type ServerSuite struct {
RemoteName string
SrcPath string
DstPath string
- DstURL string
}
var _ = Suite(&ServerSuite{})
@@ -30,9 +28,8 @@ func (s *ServerSuite) SetUpSuite(c *C) {
fixture = fixtures.ByTag("empty").One()
s.DstPath = fixture.DotGit().Base()
- s.DstURL = fmt.Sprintf("file://%s", s.DstPath)
- cmd := exec.Command("git", "remote", "add", s.RemoteName, s.DstURL)
+ cmd := exec.Command("git", "remote", "add", s.RemoteName, s.DstPath)
cmd.Dir = s.SrcPath
c.Assert(cmd.Run(), IsNil)
}
diff --git a/plumbing/transport/file/upload_pack_test.go b/plumbing/transport/file/upload_pack_test.go
index e5915f0..f013683 100644
--- a/plumbing/transport/file/upload_pack_test.go
+++ b/plumbing/transport/file/upload_pack_test.go
@@ -1,8 +1,8 @@
package file
import (
- "fmt"
"os"
+ "path/filepath"
"github.com/src-d/go-git-fixtures"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
@@ -25,20 +25,18 @@ func (s *UploadPackSuite) SetUpSuite(c *C) {
fixture := fixtures.Basic().One()
path := fixture.DotGit().Base()
- url := fmt.Sprintf("file://%s", path)
- ep, err := transport.NewEndpoint(url)
+ ep, err := transport.NewEndpoint(path)
c.Assert(err, IsNil)
s.Endpoint = ep
fixture = fixtures.ByTag("empty").One()
path = fixture.DotGit().Base()
- url = fmt.Sprintf("file://%s", path)
- ep, err = transport.NewEndpoint(url)
+ ep, err = transport.NewEndpoint(path)
c.Assert(err, IsNil)
s.EmptyEndpoint = ep
- url = fmt.Sprintf("file://%s/%s", fixtures.DataFolder, "non-existent")
- ep, err = transport.NewEndpoint(url)
+ path = filepath.Join(fixtures.DataFolder, "non-existent")
+ ep, err = transport.NewEndpoint(path)
c.Assert(err, IsNil)
s.NonExistentEndpoint = ep
}