summaryrefslogtreecommitdiffstats
path: root/hugofs/fileinfo.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugofs/fileinfo.go')
-rw-r--r--hugofs/fileinfo.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/hugofs/fileinfo.go b/hugofs/fileinfo.go
index fcf35d956..ea6ac4fd3 100644
--- a/hugofs/fileinfo.go
+++ b/hugofs/fileinfo.go
@@ -23,6 +23,8 @@ import (
"strings"
"time"
+ "github.com/gohugoio/hugo/hugofs/glob"
+
"github.com/gohugoio/hugo/hugofs/files"
"golang.org/x/text/unicode/norm"
@@ -76,6 +78,9 @@ type FileMeta struct {
Fs afero.Fs
OpenFunc func() (afero.File, error)
JoinStatFunc func(name string) (FileMetaInfo, error)
+
+ // Include only files or directories that match.
+ InclusionFilter *glob.FilenameFilter
}
func (m *FileMeta) Copy() *FileMeta {
@@ -95,10 +100,17 @@ func (m *FileMeta) Merge(from *FileMeta) {
for i := 0; i < dstv.NumField(); i++ {
v := dstv.Field(i)
+ if !v.CanSet() {
+ continue
+ }
if !hreflect.IsTruthfulValue(v) {
v.Set(srcv.Field(i))
}
}
+
+ if m.InclusionFilter == nil {
+ m.InclusionFilter = from.InclusionFilter
+ }
}
func (f *FileMeta) Open() (afero.File, error) {