mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
hugofs: Add includeFiles and excludeFiles to mount configuration
Fixes #9042
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user