From 79e065596f91df7f89c226521c75bcaeed88b45b Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 3 Feb 2015 21:04:51 +0100 Subject: [PATCH] Make CreateAtNodeAt() independend from Tree --- restorer.go | 4 ++-- tree.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/restorer.go b/restorer.go index 88fdafa83..fd0a32333 100644 --- a/restorer.go +++ b/restorer.go @@ -47,7 +47,7 @@ func (res *Restorer) to(dst string, dir string, treeBlob Blob) error { if res.Filter == nil || res.Filter(filepath.Join(res.sn.Dir, dir, node.Name), dstpath, node) { - err := tree.CreateNodeAt(node, res.s, dstpath) + err := CreateNodeAt(node, tree.Map, res.s, dstpath) // Did it fail because of ENOENT? if arrar.Check(err, func(err error) bool { @@ -60,7 +60,7 @@ func (res *Restorer) to(dst string, dir string, treeBlob Blob) error { // Create parent directories and retry err = os.MkdirAll(filepath.Dir(dstpath), 0700) if err == nil || err == os.ErrExist { - err = tree.CreateNodeAt(node, res.s, dstpath) + err = CreateNodeAt(node, tree.Map, res.s, dstpath) } } diff --git a/tree.go b/tree.go index b2d104c95..858aa1f22 100644 --- a/tree.go +++ b/tree.go @@ -383,7 +383,7 @@ func NodeFromFileInfo(path string, fi os.FileInfo) (*Node, error) { return node, err } -func (t Tree) CreateNodeAt(node *Node, s Server, path string) error { +func CreateNodeAt(node *Node, m *Map, s Server, path string) error { switch node.Type { case "dir": err := os.Mkdir(path, node.Mode) @@ -413,7 +413,7 @@ func (t Tree) CreateNodeAt(node *Node, s Server, path string) error { } for _, blobid := range node.Content { - blob, err := t.Map.FindID(blobid) + blob, err := m.FindID(blobid) if err != nil { return arrar.Annotate(err, "Find Blob") }