@@ -663,7 +663,20 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
663
663
var n int
664
664
for _ , ev := range evs {
665
665
keep := true
666
- if ev .Has (fsnotify .Create ) || ev .Has (fsnotify .Write ) {
666
+ // Write and rename operations are often followed by CHMOD.
667
+ // There may be valid use cases for rebuilding the site on CHMOD,
668
+ // but that will require more complex logic than this simple conditional.
669
+ // On OS X this seems to be related to Spotlight, see:
670
+ // https://github.com/go-fsnotify/fsnotify/issues/15
671
+ // A workaround is to put your site(s) on the Spotlight exception list,
672
+ // but that may be a little mysterious for most end users.
673
+ // So, for now, we skip reload on CHMOD.
674
+ // We do have to check for WRITE though. On slower laptops a Chmod
675
+ // could be aggregated with other important events, and we still want
676
+ // to rebuild on those
677
+ if ev .Op == fsnotify .Chmod {
678
+ keep = false
679
+ } else if ev .Has (fsnotify .Create ) || ev .Has (fsnotify .Write ) {
667
680
if _ , err := os .Stat (ev .Name ); err != nil {
668
681
keep = false
669
682
}
@@ -805,21 +818,6 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
805
818
continue
806
819
}
807
820
808
- // Write and rename operations are often followed by CHMOD.
809
- // There may be valid use cases for rebuilding the site on CHMOD,
810
- // but that will require more complex logic than this simple conditional.
811
- // On OS X this seems to be related to Spotlight, see:
812
- // https://github.com/go-fsnotify/fsnotify/issues/15
813
- // A workaround is to put your site(s) on the Spotlight exception list,
814
- // but that may be a little mysterious for most end users.
815
- // So, for now, we skip reload on CHMOD.
816
- // We do have to check for WRITE though. On slower laptops a Chmod
817
- // could be aggregated with other important events, and we still want
818
- // to rebuild on those
819
- if ev .Op & (fsnotify .Chmod | fsnotify .Write | fsnotify .Create ) == fsnotify .Chmod {
820
- continue
821
- }
822
-
823
821
walkAdder := func (path string , f hugofs.FileMetaInfo ) error {
824
822
if f .IsDir () {
825
823
c .r .logger .Println ("adding created directory to watchlist" , path )
0 commit comments