aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/filesystem/config_test.go2
-rw-r--r--storage/filesystem/internal/dotgit/dotgit.go8
-rw-r--r--storage/filesystem/internal/dotgit/dotgit_test.go29
-rw-r--r--storage/filesystem/internal/dotgit/writers.go10
-rw-r--r--storage/filesystem/internal/dotgit/writers_test.go2
-rw-r--r--storage/filesystem/module.go7
-rw-r--r--storage/filesystem/object.go2
-rw-r--r--storage/filesystem/storage.go2
-rw-r--r--storage/filesystem/storage_test.go4
9 files changed, 38 insertions, 28 deletions
diff --git a/storage/filesystem/config_test.go b/storage/filesystem/config_test.go
index b2879b3..1b812e6 100644
--- a/storage/filesystem/config_test.go
+++ b/storage/filesystem/config_test.go
@@ -8,7 +8,7 @@ import (
"gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit"
. "gopkg.in/check.v1"
- "gopkg.in/src-d/go-billy.v2/osfs"
+ "gopkg.in/src-d/go-billy.v3/osfs"
)
type ConfigSuite struct {
diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go
index 827c18d..c48f24c 100644
--- a/storage/filesystem/internal/dotgit/dotgit.go
+++ b/storage/filesystem/internal/dotgit/dotgit.go
@@ -12,7 +12,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/utils/ioutil"
- "gopkg.in/src-d/go-billy.v2"
+ "gopkg.in/src-d/go-billy.v3"
)
const (
@@ -357,7 +357,7 @@ func (d *DotGit) rewritePackedRefsWithoutRef(name plumbing.ReferenceName) (err e
return err
}
- tmpPath := tmp.Filename()
+ tmpPath := tmp.Name()
defer ioutil.CheckClose(tmp, &err)
defer d.fs.Remove(tmpPath)
@@ -481,8 +481,8 @@ func (d *DotGit) readReferenceFile(path, name string) (ref *plumbing.Reference,
}
// Module return a billy.Filesystem poiting to the module folder
-func (d *DotGit) Module(name string) billy.Filesystem {
- return d.fs.Dir(d.fs.Join(modulePath, name))
+func (d *DotGit) Module(name string) (billy.Filesystem, error) {
+ return d.fs.Chroot(d.fs.Join(modulePath, name))
}
func isHex(s string) bool {
diff --git a/storage/filesystem/internal/dotgit/dotgit_test.go b/storage/filesystem/internal/dotgit/dotgit_test.go
index e1667af..e3a3c00 100644
--- a/storage/filesystem/internal/dotgit/dotgit_test.go
+++ b/storage/filesystem/internal/dotgit/dotgit_test.go
@@ -12,7 +12,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
. "gopkg.in/check.v1"
- "gopkg.in/src-d/go-billy.v2/osfs"
+ "gopkg.in/src-d/go-billy.v3/osfs"
)
func Test(t *testing.T) { TestingT(t) }
@@ -157,7 +157,7 @@ func (s *SuiteDotGit) TestRemoveRefFromPackedRefs(c *C) {
err := dir.RemoveRef(name)
c.Assert(err, IsNil)
- b, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath))
+ b, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath))
c.Assert(err, IsNil)
c.Assert(string(b), Equals, ""+
@@ -170,7 +170,7 @@ func (s *SuiteDotGit) TestRemoveRefNonExistent(c *C) {
fs := fixtures.Basic().ByTag(".git").One().DotGit()
dir := New(fs)
- packedRefs := filepath.Join(fs.Base(), packedRefsPath)
+ packedRefs := filepath.Join(fs.Root(), packedRefsPath)
before, err := ioutil.ReadFile(packedRefs)
c.Assert(err, IsNil)
@@ -188,7 +188,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs(c *C) {
fs := fixtures.Basic().ByTag(".git").One().DotGit()
dir := New(fs)
- packedRefs := filepath.Join(fs.Base(), packedRefsPath)
+ packedRefs := filepath.Join(fs.Root(), packedRefsPath)
brokenContent := "BROKEN STUFF REALLY BROKEN"
err := ioutil.WriteFile(packedRefs, []byte(brokenContent), os.FileMode(0755))
@@ -198,7 +198,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs(c *C) {
err = dir.RemoveRef(name)
c.Assert(err, NotNil)
- after, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath))
+ after, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath))
c.Assert(err, IsNil)
c.Assert(brokenContent, Equals, string(after))
@@ -208,7 +208,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs2(c *C) {
fs := fixtures.Basic().ByTag(".git").One().DotGit()
dir := New(fs)
- packedRefs := filepath.Join(fs.Base(), packedRefsPath)
+ packedRefs := filepath.Join(fs.Root(), packedRefsPath)
brokenContent := strings.Repeat("a", bufio.MaxScanTokenSize*2)
err := ioutil.WriteFile(packedRefs, []byte(brokenContent), os.FileMode(0755))
@@ -218,7 +218,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs2(c *C) {
err = dir.RemoveRef(name)
c.Assert(err, NotNil)
- after, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath))
+ after, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath))
c.Assert(err, IsNil)
c.Assert(brokenContent, Equals, string(after))
@@ -243,7 +243,7 @@ func (s *SuiteDotGit) TestConfig(c *C) {
file, err := dir.Config()
c.Assert(err, IsNil)
- c.Assert(filepath.Base(file.Filename()), Equals, "config")
+ c.Assert(filepath.Base(file.Name()), Equals, "config")
}
func (s *SuiteDotGit) TestConfigWriteAndConfig(c *C) {
@@ -362,7 +362,7 @@ func (s *SuiteDotGit) TestObjectPack(c *C) {
pack, err := dir.ObjectPack(f.PackfileHash)
c.Assert(err, IsNil)
- c.Assert(filepath.Ext(pack.Filename()), Equals, ".pack")
+ c.Assert(filepath.Ext(pack.Name()), Equals, ".pack")
}
func (s *SuiteDotGit) TestObjectPackIdx(c *C) {
@@ -372,7 +372,7 @@ func (s *SuiteDotGit) TestObjectPackIdx(c *C) {
idx, err := dir.ObjectPackIdx(f.PackfileHash)
c.Assert(err, IsNil)
- c.Assert(filepath.Ext(idx.Filename()), Equals, ".idx")
+ c.Assert(filepath.Ext(idx.Name()), Equals, ".idx")
}
func (s *SuiteDotGit) TestObjectPackNotFound(c *C) {
@@ -445,7 +445,11 @@ func (s *SuiteDotGit) TestObject(c *C) {
file, err := dir.Object(hash)
c.Assert(err, IsNil)
c.Assert(strings.HasSuffix(
+<<<<<<< HEAD
+ file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
+=======
file.Filename(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
+>>>>>>> 86f6ba1dea8972df7c017e01ddb2c097892bc220
Equals, true,
)
}
@@ -464,6 +468,7 @@ func (s *SuiteDotGit) TestSubmodules(c *C) {
fs := fixtures.ByTag("submodule").One().DotGit()
dir := New(fs)
- m := dir.Module("basic")
- c.Assert(strings.HasSuffix(m.Base(), m.Join(".git", "module", "basic")), Equals, true)
+ m, err := dir.Module("basic")
+ c.Assert(err, IsNil)
+ c.Assert(strings.HasSuffix(m.Root(), m.Join(".git", "module", "basic")), Equals, true)
}
diff --git a/storage/filesystem/internal/dotgit/writers.go b/storage/filesystem/internal/dotgit/writers.go
index 0d2747f..2407c58 100644
--- a/storage/filesystem/internal/dotgit/writers.go
+++ b/storage/filesystem/internal/dotgit/writers.go
@@ -10,7 +10,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing/format/objfile"
"gopkg.in/src-d/go-git.v4/plumbing/format/packfile"
- "gopkg.in/src-d/go-billy.v2"
+ "gopkg.in/src-d/go-billy.v3"
)
// PackWriter is a io.Writer that generates the packfile index simultaneously,
@@ -36,7 +36,7 @@ func newPackWrite(fs billy.Filesystem) (*PackWriter, error) {
return nil, err
}
- fr, err := fs.Open(fw.Filename())
+ fr, err := fs.Open(fw.Name())
if err != nil {
return nil, err
}
@@ -130,7 +130,7 @@ func (w *PackWriter) Close() error {
}
func (w *PackWriter) clean() error {
- return w.fs.Remove(w.fw.Filename())
+ return w.fs.Remove(w.fw.Name())
}
func (w *PackWriter) save() error {
@@ -148,7 +148,7 @@ func (w *PackWriter) save() error {
return err
}
- return w.fs.Rename(w.fw.Filename(), fmt.Sprintf("%s.pack", base))
+ return w.fs.Rename(w.fw.Name(), fmt.Sprintf("%s.pack", base))
}
func (w *PackWriter) encodeIdx(writer io.Writer) error {
@@ -282,5 +282,5 @@ func (w *ObjectWriter) save() error {
hash := w.Hash().String()
file := w.fs.Join(objectsPath, hash[0:2], hash[2:40])
- return w.fs.Rename(w.f.Filename(), file)
+ return w.fs.Rename(w.f.Name(), file)
}
diff --git a/storage/filesystem/internal/dotgit/writers_test.go b/storage/filesystem/internal/dotgit/writers_test.go
index e7d7ef9..d2c7b6f 100644
--- a/storage/filesystem/internal/dotgit/writers_test.go
+++ b/storage/filesystem/internal/dotgit/writers_test.go
@@ -11,7 +11,7 @@ import (
"github.com/src-d/go-git-fixtures"
. "gopkg.in/check.v1"
- "gopkg.in/src-d/go-billy.v2/osfs"
+ "gopkg.in/src-d/go-billy.v3/osfs"
)
func (s *SuiteDotGit) TestNewObjectPack(c *C) {
diff --git a/storage/filesystem/module.go b/storage/filesystem/module.go
index 2e469d3..6f3de3f 100644
--- a/storage/filesystem/module.go
+++ b/storage/filesystem/module.go
@@ -10,5 +10,10 @@ type ModuleStorage struct {
}
func (s *ModuleStorage) Module(name string) (storage.Storer, error) {
- return NewStorage(s.dir.Module(name))
+ fs, err := s.dir.Module(name)
+ if err != nil {
+ return nil, err
+ }
+
+ return NewStorage(fs)
}
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 782b99b..dc88108 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -12,7 +12,7 @@ import (
"gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit"
"gopkg.in/src-d/go-git.v4/storage/memory"
- "gopkg.in/src-d/go-billy.v2"
+ "gopkg.in/src-d/go-billy.v3"
)
type ObjectStorage struct {
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index 768238e..2c7c107 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -4,7 +4,7 @@ package filesystem
import (
"gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit"
- "gopkg.in/src-d/go-billy.v2"
+ "gopkg.in/src-d/go-billy.v3"
)
// Storage is an implementation of git.Storer that stores data on disk in the
diff --git a/storage/filesystem/storage_test.go b/storage/filesystem/storage_test.go
index 03d2e86..2ced9dd 100644
--- a/storage/filesystem/storage_test.go
+++ b/storage/filesystem/storage_test.go
@@ -7,8 +7,8 @@ import (
"gopkg.in/src-d/go-git.v4/storage/test"
. "gopkg.in/check.v1"
- "gopkg.in/src-d/go-billy.v2/memfs"
- "gopkg.in/src-d/go-billy.v2/osfs"
+ "gopkg.in/src-d/go-billy.v3/memfs"
+ "gopkg.in/src-d/go-billy.v3/osfs"
)
func Test(t *testing.T) { TestingT(t) }