commands: Fix config reloading in Vim and similar
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 30 Jul 2019 07:35:01 +0000 (09:35 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 30 Jul 2019 07:35:01 +0000 (09:35 +0200)
The config path was simplified in Hugo 0.56.0 to support more config dirs/files (go.mod etc.),
and the new code path assumed that every file change would trigger a `Write` event.

This is not true for Vim etc. which triggers a `Chmod` and then a `Rename`.

Lesson learned: Be really careful changing Os/editor specific code without proper tests.

Fixes #6139

commands/hugo.go

index 36d3812ebc234ff04d502bfa900cd128122cc9b2..f9d4c12a5cf48dbf485da981046692c429e3d489 100644 (file)
@@ -914,12 +914,12 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
                                        }
                                }
 
-                               // A write event will follow.
-                               continue
                        }
 
                        // Config file(s) changed. Need full rebuild.
                        c.fullRebuild(configChangeType)
+
+                       return
                }
        }