mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
hugolib: Fix live-reload regression for add/removal of dirs
This reverts commit b5b6e81c02
.
That change breaks watching of new directories (new dirs, deleted dirs).
Reopens #3325
Fixes #3569
This commit is contained in:
@@ -753,9 +753,6 @@ func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
|
|||||||
go pageConverter(pageChan, convertResults, wg2)
|
go pageConverter(pageChan, convertResults, wg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
sp := source.NewSourceSpec(s.Cfg, s.Fs)
|
|
||||||
fs := sp.NewFilesystem("")
|
|
||||||
|
|
||||||
for _, ev := range sourceChanged {
|
for _, ev := range sourceChanged {
|
||||||
// The incrementalReadCollator below will also make changes to the site's pages,
|
// The incrementalReadCollator below will also make changes to the site's pages,
|
||||||
// so we do this first to prevent races.
|
// so we do this first to prevent races.
|
||||||
@@ -778,15 +775,6 @@ func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore files shouldn't be proceed
|
|
||||||
if fi, err := s.Fs.Source.Stat(ev.Name); err != nil {
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
if ok, err := fs.ShouldRead(ev.Name, fi); err != nil || !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceReallyChanged = append(sourceReallyChanged, ev)
|
sourceReallyChanged = append(sourceReallyChanged, ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ func (f *Filesystem) captureFiles() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := f.ShouldRead(filePath, fi)
|
b, err := f.shouldRead(filePath, fi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ func (f *Filesystem) captureFiles() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Filesystem) ShouldRead(filePath string, fi os.FileInfo) (bool, error) {
|
func (f *Filesystem) shouldRead(filePath string, fi os.FileInfo) (bool, error) {
|
||||||
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||||
link, err := filepath.EvalSymlinks(filePath)
|
link, err := filepath.EvalSymlinks(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user