aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugofs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-11-04 10:31:59 +0100
committerBjørn Erik Pedersen <[email protected]>2024-11-04 12:44:07 +0100
commitfcdc454cc58e9f26ba29389100adfc09cb383448 (patch)
tree1d66ea84f966549b51ada9a74cc40c4e4ac69c59 /hugofs
parent6cf23bf8824758b0d2c4d855f0241e72aef77206 (diff)
downloadhugo-fcdc454cc58e9f26ba29389100adfc09cb383448.tar.gz
hugo-fcdc454cc58e9f26ba29389100adfc09cb383448.zip
Do not watch directories with no mounted files in it
Fixes #12912 Fixes #13007
Diffstat (limited to 'hugofs')
-rw-r--r--hugofs/rootmapping_fs.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/hugofs/rootmapping_fs.go b/hugofs/rootmapping_fs.go
index 2ecd88e9e..02e541a05 100644
--- a/hugofs/rootmapping_fs.go
+++ b/hugofs/rootmapping_fs.go
@@ -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