Do not watch directories with no mounted files in it

Fixes #12912
Fixes #13007
This commit is contained in:
Bjørn Erik Pedersen
2024-11-04 10:31:59 +01:00
parent 6cf23bf882
commit fcdc454cc5
2 changed files with 35 additions and 8 deletions

View File

@@ -246,11 +246,11 @@ func (fs *RootMappingFs) Mounts(base string) ([]FileMetaInfo, error) {
return nil, nil
}
fss := make([]FileMetaInfo, len(roots))
for i, r := range roots {
fss := make([]FileMetaInfo, 0, len(roots))
for _, r := range roots {
if r.fiSingleFile != nil {
// A single file mount.
fss[i] = r.fiSingleFile
fss = append(fss, r.fiSingleFile)
continue
}
bfs := NewBasePathFs(fs.Fs, r.To)
@@ -261,9 +261,9 @@ func (fs *RootMappingFs) Mounts(base string) ([]FileMetaInfo, error) {
fs = decorateDirs(fs, r.Meta)
fi, err := fs.Stat("")
if err != nil {
return nil, fmt.Errorf("RootMappingFs.Dirs: %w", err)
continue
}
fss[i] = fi.(FileMetaInfo)
fss = append(fss, fi.(FileMetaInfo))
}
return fss, nil