This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ func newFolder(model *model, fset *db.FileSet, ignores *ignore.Matcher, cfg conf
|
||||
shortID: model.shortID,
|
||||
fset: fset,
|
||||
ignores: ignores,
|
||||
mtimefs: fset.MtimeFS(),
|
||||
mtimefs: fset.MtimeFS(cfg.Filesystem()),
|
||||
modTimeWindow: cfg.ModTimeWindow(),
|
||||
done: make(chan struct{}),
|
||||
|
||||
|
||||
@@ -805,8 +805,8 @@ func TestCopyOwner(t *testing.T) {
|
||||
f.folder.FolderConfiguration = newFolderConfiguration(m.cfg, f.ID, f.Label, fs.FilesystemTypeFake, "/TestCopyOwner")
|
||||
f.folder.FolderConfiguration.CopyOwnershipFromParent = true
|
||||
|
||||
f.fset = newFileSet(t, f.ID, f.Filesystem(), m.db)
|
||||
f.mtimefs = f.fset.MtimeFS()
|
||||
f.fset = newFileSet(t, f.ID, m.db)
|
||||
f.mtimefs = f.fset.MtimeFS(f.Filesystem())
|
||||
|
||||
// Create a parent dir with a certain owner/group.
|
||||
|
||||
|
||||
+4
-3
@@ -553,7 +553,7 @@ func (m *model) restartFolder(from, to config.FolderConfiguration, cacheIgnoredF
|
||||
// locking, but it's unsafe to create fset:s concurrently so
|
||||
// that's the price we pay.
|
||||
var err error
|
||||
fset, err = db.NewFileSet(folder, to.Filesystem(), m.db)
|
||||
fset, err = db.NewFileSet(folder, m.db)
|
||||
if err != nil {
|
||||
return fmt.Errorf("restarting %v: %w", to.Description(), err)
|
||||
}
|
||||
@@ -586,7 +586,7 @@ func (m *model) restartFolder(from, to config.FolderConfiguration, cacheIgnoredF
|
||||
func (m *model) newFolder(cfg config.FolderConfiguration, cacheIgnoredFiles bool) error {
|
||||
// Creating the fileset can take a long time (metadata calculation) so
|
||||
// we do it outside of the lock.
|
||||
fset, err := db.NewFileSet(cfg.ID, cfg.Filesystem(), m.db)
|
||||
fset, err := db.NewFileSet(cfg.ID, m.db)
|
||||
if err != nil {
|
||||
return fmt.Errorf("adding %v: %w", cfg.Description(), err)
|
||||
}
|
||||
@@ -2003,11 +2003,12 @@ func (m *model) CurrentGlobalFile(folder string, file string) (protocol.FileInfo
|
||||
func (m *model) GetMtimeMapping(folder string, file string) (fs.MtimeMapping, error) {
|
||||
m.fmut.RLock()
|
||||
ffs, ok := m.folderFiles[folder]
|
||||
fcfg := m.folderCfgs[folder]
|
||||
m.fmut.RUnlock()
|
||||
if !ok {
|
||||
return fs.MtimeMapping{}, ErrFolderMissing
|
||||
}
|
||||
return fs.GetMtimeMapping(ffs.MtimeFS(), file)
|
||||
return fs.GetMtimeMapping(ffs.MtimeFS(fcfg.Filesystem()), file)
|
||||
}
|
||||
|
||||
// Connection returns the current connection for device, and a boolean whether a connection was found.
|
||||
|
||||
@@ -1621,7 +1621,7 @@ func TestROScanRecovery(t *testing.T) {
|
||||
defer cancel()
|
||||
m := newModel(t, cfg, myID, "syncthing", "dev", nil)
|
||||
|
||||
set := newFileSet(t, "default", defaultFs, m.db)
|
||||
set := newFileSet(t, "default", m.db)
|
||||
set.Update(protocol.LocalDeviceID, []protocol.FileInfo{
|
||||
{Name: "dummyfile", Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 1}}}},
|
||||
})
|
||||
@@ -1676,7 +1676,7 @@ func TestRWScanRecovery(t *testing.T) {
|
||||
|
||||
testOs.RemoveAll(fcfg.Path)
|
||||
|
||||
set := newFileSet(t, "default", defaultFs, m.db)
|
||||
set := newFileSet(t, "default", m.db)
|
||||
set.Update(protocol.LocalDeviceID, []protocol.FileInfo{
|
||||
{Name: "dummyfile", Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 1}}}},
|
||||
})
|
||||
@@ -2177,7 +2177,7 @@ func TestIssue2782(t *testing.T) {
|
||||
func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
||||
m := newModel(t, defaultCfgWrapper, myID, "syncthing", "dev", nil)
|
||||
|
||||
files := newFileSet(t, "default", defaultFs, m.db)
|
||||
files := newFileSet(t, "default", m.db)
|
||||
files.Drop(device1)
|
||||
files.Update(device1, genFiles(1))
|
||||
files.Drop(device2)
|
||||
@@ -2191,7 +2191,7 @@ func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
||||
defer cleanupModel(m)
|
||||
|
||||
// Remote sequence is cached, hence need to recreated.
|
||||
files = newFileSet(t, "default", defaultFs, m.db)
|
||||
files = newFileSet(t, "default", m.db)
|
||||
|
||||
if l := len(files.ListDevices()); l != 1 {
|
||||
t.Errorf("Expected one device got %v", l)
|
||||
@@ -2622,7 +2622,7 @@ func TestCustomMarkerName(t *testing.T) {
|
||||
testOs.RemoveAll(fcfg.Path)
|
||||
|
||||
m := newModel(t, cfg, myID, "syncthing", "dev", nil)
|
||||
set := newFileSet(t, "default", defaultFs, m.db)
|
||||
set := newFileSet(t, "default", m.db)
|
||||
set.Update(protocol.LocalDeviceID, []protocol.FileInfo{
|
||||
{Name: "dummyfile"},
|
||||
})
|
||||
|
||||
@@ -307,7 +307,7 @@ func fsetSnapshot(t *testing.T, fset *db.FileSet) *db.Snapshot {
|
||||
func folderIgnoresAlwaysReload(t testing.TB, m *testModel, fcfg config.FolderConfiguration) {
|
||||
t.Helper()
|
||||
m.removeFolder(fcfg)
|
||||
fset := newFileSet(t, fcfg.ID, fcfg.Filesystem(), m.db)
|
||||
fset := newFileSet(t, fcfg.ID, m.db)
|
||||
ignores := ignore.New(fcfg.Filesystem(), ignore.WithCache(true), ignore.WithChangeDetector(newAlwaysChanged()))
|
||||
m.fmut.Lock()
|
||||
m.addAndStartFolderLockedWithIgnores(fcfg, fset, ignores)
|
||||
@@ -359,9 +359,9 @@ func newDeviceConfiguration(defaultCfg config.DeviceConfiguration, id protocol.D
|
||||
return cfg
|
||||
}
|
||||
|
||||
func newFileSet(t testing.TB, folder string, fs fs.Filesystem, ldb *db.Lowlevel) *db.FileSet {
|
||||
func newFileSet(t testing.TB, folder string, ldb *db.Lowlevel) *db.FileSet {
|
||||
t.Helper()
|
||||
fset, err := db.NewFileSet(folder, fs, ldb)
|
||||
fset, err := db.NewFileSet(folder, ldb)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user