From cef57e7abd2cfe2b6d66e409530a1a35cac1079d Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 8 Jul 2015 22:35:41 +0200 Subject: [PATCH] restorer: Initialize SelectForRestore with default --- restorer.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/restorer.go b/restorer.go index d003aa3e1..25bb1e3cd 100644 --- a/restorer.go +++ b/restorer.go @@ -26,7 +26,10 @@ var restorerAbortOnAllErrors = func(str string, node *Node, err error) error { r // NewRestorer creates a restorer preloaded with the content from the snapshot id. func NewRestorer(repo *repository.Repository, id backend.ID) (*Restorer, error) { - r := &Restorer{repo: repo, Error: restorerAbortOnAllErrors} + r := &Restorer{ + repo: repo, Error: restorerAbortOnAllErrors, + SelectForRestore: func(string, string, *Node) bool { return true }, + } var err error @@ -45,14 +48,9 @@ func (res *Restorer) restoreTo(dst string, dir string, treeID backend.ID) error } for _, node := range tree.Nodes { - selectedForRestore := true - if res.SelectForRestore != nil { - debug.Log("Restorer.restoreTo", "running select filter for %v", node.Name) - - selectedForRestore = res.SelectForRestore(filepath.Join(dir, node.Name), - filepath.Join(dst, dir, node.Name), node) - debug.Log("Restorer.restoreNodeTo", "SelectForRestore returned %v", selectedForRestore) - } + selectedForRestore := res.SelectForRestore(filepath.Join(dir, node.Name), + filepath.Join(dst, dir, node.Name), node) + debug.Log("Restorer.restoreNodeTo", "SelectForRestore returned %v", selectedForRestore) if selectedForRestore { err := res.restoreNodeTo(node, dir, dst)