lib/ignore: Implement deletable ignores using (?d) prefix (fixes #1362)
This commit is contained in:
committed by
Jakob Borg
parent
4f5d0b46f7
commit
5a98af622d
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/rcrowley/go-metrics"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/events"
|
||||
"github.com/syncthing/syncthing/lib/ignore"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/symlinks"
|
||||
@@ -50,7 +51,7 @@ type Walker struct {
|
||||
// BlockSize controls the size of the block used when hashing.
|
||||
BlockSize int
|
||||
// If Matcher is not nil, it is used to identify files to ignore which were specified by the user.
|
||||
Matcher IgnoreMatcher
|
||||
Matcher *ignore.Matcher
|
||||
// If TempNamer is not nil, it is used to ignore temporary files when walking.
|
||||
TempNamer TempNamer
|
||||
// Number of hours to keep temporary files for
|
||||
@@ -89,11 +90,6 @@ type CurrentFiler interface {
|
||||
CurrentFile(name string) (protocol.FileInfo, bool)
|
||||
}
|
||||
|
||||
type IgnoreMatcher interface {
|
||||
// Match returns true if the file should be ignored.
|
||||
Match(filename string) bool
|
||||
}
|
||||
|
||||
// Walk returns the list of files found in the local folder by scanning the
|
||||
// file system. Files are blockwise hashed.
|
||||
func (w *Walker) Walk() (chan protocol.FileInfo, error) {
|
||||
@@ -241,7 +237,7 @@ func (w *Walker) walkAndHashFiles(fchan, dchan chan protocol.FileInfo) filepath.
|
||||
}
|
||||
|
||||
if sn := filepath.Base(relPath); sn == ".stignore" || sn == ".stfolder" ||
|
||||
strings.HasPrefix(relPath, ".stversions") || (w.Matcher != nil && w.Matcher.Match(relPath)) {
|
||||
strings.HasPrefix(relPath, ".stversions") || (w.Matcher != nil && w.Matcher.Match(relPath).IsIgnored()) {
|
||||
// An ignored file
|
||||
l.Debugln("ignored:", relPath)
|
||||
return skip
|
||||
|
||||
Reference in New Issue
Block a user