Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-11 11:48:20 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-11 15:10:47 +0300
commit64b7b7a89753a39661219b2fcb92d7f185a03f63 (patch)
treefc0a936c03faffd4acfd28b4997f499e4109dcfb /hugolib
parent5ef8a9f32c25a9b4cc821393c58733e57a7ad234 (diff)
Revert "Allow rendering static files to disk and dynamic to memory in server mode"
This reverts commit 7d8011ed63d587b87a7c182748914fe146590093. Updates #9647
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/filesystems/basefs.go13
-rw-r--r--hugolib/pages_process.go16
-rw-r--r--hugolib/site.go4
3 files changed, 10 insertions, 23 deletions
diff --git a/hugolib/filesystems/basefs.go b/hugolib/filesystems/basefs.go
index 1614bd0b3..2e32932c6 100644
--- a/hugolib/filesystems/basefs.go
+++ b/hugolib/filesystems/basefs.go
@@ -71,9 +71,6 @@ type BaseFs struct {
// A read-only filesystem starting from the project workDir.
WorkDir afero.Fs
- // The filesystem used for renderStaticToDisk.
- PublishFsStatic afero.Fs
-
theBigFs *filesystemsCollector
// Locks.
@@ -441,17 +438,15 @@ func NewBase(p *paths.Paths, logger loggers.Logger, options ...func(*BaseFs) err
publishFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Destination, p.AbsPublishDir))
sourceFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Source, p.WorkingDir))
- publishFsStatic := afero.NewBasePathFs(fs.Source, p.AbsPublishDir)
// Same as sourceFs, but no decoration. This is what's used by os.ReadDir etc.
workDir := afero.NewBasePathFs(afero.NewReadOnlyFs(fs.Source), p.WorkingDir)
b := &BaseFs{
- SourceFs: sourceFs,
- WorkDir: workDir,
- PublishFs: publishFs,
- PublishFsStatic: publishFsStatic,
- buildMu: lockedfile.MutexAt(filepath.Join(p.WorkingDir, lockFileBuild)),
+ SourceFs: sourceFs,
+ WorkDir: workDir,
+ PublishFs: publishFs,
+ buildMu: lockedfile.MutexAt(filepath.Join(p.WorkingDir, lockFileBuild)),
}
for _, opt := range options {
diff --git a/hugolib/pages_process.go b/hugolib/pages_process.go
index 59b20dabc..541c0ae3e 100644
--- a/hugolib/pages_process.go
+++ b/hugolib/pages_process.go
@@ -33,10 +33,9 @@ func newPagesProcessor(h *HugoSites, sp *source.SourceSpec) *pagesProcessor {
procs := make(map[string]pagesCollectorProcessorProvider)
for _, s := range h.Sites {
procs[s.Lang()] = &sitePagesProcessor{
- m: s.pageMap,
- errorSender: s.h,
- itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
- renderStaticToDisk: h.Cfg.GetBool("renderStaticToDisk"),
+ m: s.pageMap,
+ errorSender: s.h,
+ itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
}
}
return &pagesProcessor{
@@ -119,8 +118,6 @@ type sitePagesProcessor struct {
ctx context.Context
itemChan chan interface{}
itemGroup *errgroup.Group
-
- renderStaticToDisk bool
}
func (p *sitePagesProcessor) Process(item interface{}) error {
@@ -165,12 +162,7 @@ func (p *sitePagesProcessor) copyFile(fim hugofs.FileMetaInfo) error {
defer f.Close()
- fs := s.PublishFs
- if p.renderStaticToDisk {
- fs = s.PublishFsStatic
- }
-
- return s.publish(&s.PathSpec.ProcessingStats.Files, target, f, fs)
+ return s.publish(&s.PathSpec.ProcessingStats.Files, target, f)
}
func (p *sitePagesProcessor) doProcess(item interface{}) error {
diff --git a/hugolib/site.go b/hugolib/site.go
index 0b8e807dd..c76bdc141 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1824,10 +1824,10 @@ func (s *Site) lookupTemplate(layouts ...string) (tpl.Template, bool) {
return nil, false
}
-func (s *Site) publish(statCounter *uint64, path string, r io.Reader, fs afero.Fs) (err error) {
+func (s *Site) publish(statCounter *uint64, path string, r io.Reader) (err error) {
s.PathSpec.ProcessingStats.Incr(statCounter)
- return helpers.WriteToDisk(filepath.Clean(path), r, fs)
+ return helpers.WriteToDisk(filepath.Clean(path), r, s.BaseFs.PublishFs)
}
func (s *Site) kindFromFileInfoOrSections(fi *fileInfo, sections []string) string {