diff --git a/internal/restic/snapshot.go b/internal/restic/snapshot.go index 10c4f218e..9eb7ab3ab 100644 --- a/internal/restic/snapshot.go +++ b/internal/restic/snapshot.go @@ -237,19 +237,14 @@ func (sn *Snapshot) HasTagList(l []TagList) bool { return false } -func (sn *Snapshot) hasPath(path string) bool { - for _, snPath := range sn.Paths { - if path == snPath { - return true - } - } - return false -} - // HasPaths returns true if the snapshot has all of the paths. func (sn *Snapshot) HasPaths(paths []string) bool { + m := make(map[string]struct{}, len(sn.Paths)) + for _, snPath := range sn.Paths { + m[snPath] = struct{}{} + } for _, path := range paths { - if !sn.hasPath(path) { + if _, ok := m[path]; !ok { return false } }