aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/filesystem
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-19 22:04:46 +0200
committerGitHub <noreply@github.com>2017-07-19 22:04:46 +0200
commit8738a04708b91683d5804b4c648c871fdeb87f82 (patch)
tree017b15080dee8bd64026c9358d832e61d12674d5 /utils/merkletrie/filesystem
parent595dfe6e53a038da4949263ea2d9a7a0020c48b7 (diff)
parent4a7e7cddc0e4f88085b263693c87635254de7f35 (diff)
downloadgo-git-8738a04708b91683d5804b4c648c871fdeb87f82.tar.gz
Merge pull request #493 from src-d/windows
*: several windows support fixes
Diffstat (limited to 'utils/merkletrie/filesystem')
-rw-r--r--utils/merkletrie/filesystem/node.go6
-rw-r--r--utils/merkletrie/filesystem/node_test.go10
2 files changed, 9 insertions, 7 deletions
diff --git a/utils/merkletrie/filesystem/node.go b/utils/merkletrie/filesystem/node.go
index a8f3b86..f763e08 100644
--- a/utils/merkletrie/filesystem/node.go
+++ b/utils/merkletrie/filesystem/node.go
@@ -3,7 +3,7 @@ package filesystem
import (
"io"
"os"
- "path/filepath"
+ "path"
"gopkg.in/src-d/go-billy.v3"
"gopkg.in/src-d/go-git.v4/plumbing"
@@ -53,7 +53,7 @@ func (n *node) Hash() []byte {
}
func (n *node) Name() string {
- return filepath.Base(n.path)
+ return path.Base(n.path)
}
func (n *node) IsDir() bool {
@@ -107,7 +107,7 @@ func (n *node) calculateChildren() error {
}
func (n *node) newChildNode(file os.FileInfo) (*node, error) {
- path := filepath.Join(n.path, file.Name())
+ path := path.Join(n.path, file.Name())
hash, err := n.calculateHash(path, file)
if err != nil {
diff --git a/utils/merkletrie/filesystem/node_test.go b/utils/merkletrie/filesystem/node_test.go
index bf1178a..42dd82e 100644
--- a/utils/merkletrie/filesystem/node_test.go
+++ b/utils/merkletrie/filesystem/node_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"io"
"os"
+ "path"
"testing"
. "gopkg.in/check.v1"
@@ -133,18 +134,19 @@ func (s *NoderSuite) TestDiffChangeModeNotRelevant(c *C) {
}
func (s *NoderSuite) TestDiffDirectory(c *C) {
+ dir := path.Join("qux", "bar")
fsA := memfs.New()
- fsA.MkdirAll("qux/bar", 0644)
+ fsA.MkdirAll(dir, 0644)
fsB := memfs.New()
- fsB.MkdirAll("qux/bar", 0644)
+ fsB.MkdirAll(dir, 0644)
ch, err := merkletrie.DiffTree(
NewRootNode(fsA, map[string]plumbing.Hash{
- "qux/bar": plumbing.NewHash("aa102815663d23f8b75a47e7a01965dcdc96468c"),
+ dir: plumbing.NewHash("aa102815663d23f8b75a47e7a01965dcdc96468c"),
}),
NewRootNode(fsB, map[string]plumbing.Hash{
- "qux/bar": plumbing.NewHash("19102815663d23f8b75a47e7a01965dcdc96468c"),
+ dir: plumbing.NewHash("19102815663d23f8b75a47e7a01965dcdc96468c"),
}),
IsEquals,
)