From bf97cc7efa36b45fa9885b2f18b3434adff3fe45 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 2 Mar 2017 14:50:54 +0100 Subject: [PATCH 1/2] Allow filtering absolute paths Before, the restorer called the filter function with a relative path, this prevented anchoring absolute patterns (which just never matched). Now call the restore function with an absolute virtual path, starting at the filepath separator. Closes #834 --- src/restic/restorer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/restic/restorer.go b/src/restic/restorer.go index 4a271cec0..2d1513bb7 100644 --- a/src/restic/restorer.go +++ b/src/restic/restorer.go @@ -120,7 +120,7 @@ func (res *Restorer) restoreNodeTo(node *Node, dir string, dst string, idx *Hard // Before an item is created, res.Filter is called. func (res *Restorer) RestoreTo(dir string) error { idx := NewHardlinkIndex() - return res.restoreTo(dir, "", *res.sn.Tree, idx) + return res.restoreTo(dir, string(filepath.Separator), *res.sn.Tree, idx) } // Snapshot returns the snapshot this restorer is configured to use. From 7c92994f1062b6f19df0f2dfa1a54c04b14cc2d9 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 2 Mar 2017 14:52:18 +0100 Subject: [PATCH 2/2] Clarify variable name --- src/restic/restorer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/restic/restorer.go b/src/restic/restorer.go index 2d1513bb7..56916f3ce 100644 --- a/src/restic/restorer.go +++ b/src/restic/restorer.go @@ -116,11 +116,11 @@ func (res *Restorer) restoreNodeTo(node *Node, dir string, dst string, idx *Hard return nil } -// RestoreTo creates the directories and files in the snapshot below dir. +// RestoreTo creates the directories and files in the snapshot below dst. // Before an item is created, res.Filter is called. -func (res *Restorer) RestoreTo(dir string) error { +func (res *Restorer) RestoreTo(dst string) error { idx := NewHardlinkIndex() - return res.restoreTo(dir, string(filepath.Separator), *res.sn.Tree, idx) + return res.restoreTo(dst, string(filepath.Separator), *res.sn.Tree, idx) } // Snapshot returns the snapshot this restorer is configured to use.