forked from TrueCloudLab/restic
restorer: Initialize SelectForRestore with default
This commit is contained in:
parent
7255e4feb3
commit
cef57e7abd
1 changed files with 7 additions and 9 deletions
16
restorer.go
16
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.
|
// NewRestorer creates a restorer preloaded with the content from the snapshot id.
|
||||||
func NewRestorer(repo *repository.Repository, id backend.ID) (*Restorer, error) {
|
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
|
var err error
|
||||||
|
|
||||||
|
@ -45,14 +48,9 @@ func (res *Restorer) restoreTo(dst string, dir string, treeID backend.ID) error
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, node := range tree.Nodes {
|
for _, node := range tree.Nodes {
|
||||||
selectedForRestore := true
|
selectedForRestore := res.SelectForRestore(filepath.Join(dir, node.Name),
|
||||||
if res.SelectForRestore != nil {
|
filepath.Join(dst, dir, node.Name), node)
|
||||||
debug.Log("Restorer.restoreTo", "running select filter for %v", node.Name)
|
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 {
|
if selectedForRestore {
|
||||||
err := res.restoreNodeTo(node, dir, dst)
|
err := res.restoreNodeTo(node, dir, dst)
|
||||||
|
|
Loading…
Reference in a new issue