瀏覽代碼

lib/scanner need not depend on lib/ignore

Jakob Borg 10 年之前
父節點
當前提交
54269553c8
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      lib/scanner/walk.go

+ 6 - 2
lib/scanner/walk.go

@@ -19,7 +19,6 @@ import (
 	"github.com/syncthing/protocol"
 	"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/symlinks"
 	"golang.org/x/text/unicode/norm"
@@ -50,7 +49,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 *ignore.Matcher
+	Matcher IgnoreMatcher
 	// If TempNamer is not nil, it is used to ignore temporary files when walking.
 	TempNamer TempNamer
 	// Number of hours to keep temporary files for
@@ -87,6 +86,11 @@ 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) {