repair snapshots: cleanup warnings

This commit is contained in:
Michael Eischer 2022-12-28 12:15:39 +01:00
parent f6cc10578d
commit 7c8dd61e8c

View file

@ -130,11 +130,12 @@ func runRepairSnapshots(ctx context.Context, gopts GlobalOptions, opts RepairOpt
},
RewriteFailedTree: func(nodeID restic.ID, path string, _ error) (restic.ID, error) {
if path == "/" {
Verbosef(" dir %q: not readable\n", path)
// remove snapshots with invalid root node
return restic.ID{}, nil
}
// If a subtree fails to load, remove it
Printf("removed defective dir '%v'", path)
Verbosef(" dir %q: replaced with empty directory\n", path)
emptyID, err := restic.SaveTree(ctx, repo, &restic.Tree{})
if err != nil {
return restic.ID{}, err