restore: exclude/include xattrs

For: https://github.com/restic/restic/issues/5089

Signed-off-by: Tesshu Flower <tflower@redhat.com>
This commit is contained in:
Tesshu Flower
2024-11-04 02:14:45 -05:00
parent e6f9cfb8c8
commit af839f9548
6 changed files with 70 additions and 21 deletions

View File

@@ -31,6 +31,8 @@ type Restorer struct {
// SelectFilter determines whether the item is selectedForRestore or whether a childMayBeSelected.
// selectedForRestore must not depend on isDir as `removeUnexpectedFiles` always passes false to isDir.
SelectFilter func(item string, isDir bool) (selectedForRestore bool, childMayBeSelected bool)
XattrSelectFilter func(xattrName string) (xattrSelectedForRestore bool)
}
var restorerAbortOnAllErrors = func(_ string, err error) error { return err }
@@ -288,7 +290,7 @@ func (res *Restorer) restoreNodeMetadataTo(node *restic.Node, target, location s
return nil
}
debug.Log("restoreNodeMetadata %v %v %v", node.Name, target, location)
err := fs.NodeRestoreMetadata(node, target, res.Warn)
err := fs.NodeRestoreMetadata(node, target, res.Warn, res.XattrSelectFilter)
if err != nil {
debug.Log("node.RestoreMetadata(%s) error %v", target, err)
}