hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit bef5048580b38b0c29edef4eb8c67915033120e9
parent 49a104309d53af243b32443a59bdc2a6fc9beeef
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Wed,  7 Jun 2017 22:31:57 +0200

Revert "hugolib: Fix live-reload regression for add/removal of dirs"

Never mind. The "adding dir" scenario didn't work anyway, so that will need another fix.

This reverts commit 49a104309d53af243b32443a59bdc2a6fc9beeef.

Closes ##3325

Diffstat:
Mhugolib/site.go | 12++++++++++++
Msource/filesystem.go | 4++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -753,6 +753,9 @@ func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
 		go pageConverter(pageChan, convertResults, wg2)
 	}
 
+	sp := source.NewSourceSpec(s.Cfg, s.Fs)
+	fs := sp.NewFilesystem("")
+
 	for _, ev := range sourceChanged {
 		// The incrementalReadCollator below will also make changes to the site's pages,
 		// so we do this first to prevent races.
@@ -775,6 +778,15 @@ 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)
 	}
 
diff --git a/source/filesystem.go b/source/filesystem.go
@@ -90,7 +90,7 @@ func (f *Filesystem) captureFiles() {
 			return nil
 		}
 
-		b, err := f.shouldRead(filePath, fi)
+		b, err := f.ShouldRead(filePath, fi)
 		if err != nil {
 			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 {
 		link, err := filepath.EvalSymlinks(filePath)
 		if err != nil {