rewrite: use SelectByName like in the backup command

This commit is contained in:
Michael Eischer
2022-11-12 19:55:22 +01:00
parent 7ebaf6e899
commit ad14d6e4ac
2 changed files with 9 additions and 7 deletions
+4 -4
View File
@@ -81,13 +81,13 @@ func rewriteSnapshot(ctx context.Context, repo *repository.Repository, sn *resti
return false, err
}
checkExclude := func(nodepath string) bool {
selectByName := func(nodepath string) bool {
for _, reject := range rejectByNameFuncs {
if reject(nodepath) {
return true
return false
}
}
return false
return true
}
wg, wgCtx := errgroup.WithContext(ctx)
@@ -96,7 +96,7 @@ func rewriteSnapshot(ctx context.Context, repo *repository.Repository, sn *resti
var filteredTree restic.ID
wg.Go(func() error {
filteredTree, err = walker.FilterTree(wgCtx, repo, "/", *sn.Tree, &walker.TreeFilterVisitor{
CheckExclude: checkExclude,
SelectByName: selectByName,
PrintExclude: func(path string) { Verbosef(fmt.Sprintf("excluding %s\n", path)) },
})
if err != nil {