summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-05-12 11:18:18 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-05-14 13:40:56 +0200
commit4a96df96d958a8ce122f103c4b417eaba52e6cb1 (patch)
tree359449203e3ef67f3616f2ddcee80fcd09e2c62f
parente8537e6dd0ae41427bd03d98477d4a6a1f71a2cc (diff)
server: Always rebuild the files involved in an error
Fixes #9884
-rw-r--r--commands/hugo.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index c13fdce06..ada1e1cef 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -33,6 +33,7 @@ import (
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/tpl"
+ "github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/common/htime"
"github.com/gohugoio/hugo/common/types"
@@ -742,6 +743,12 @@ func (c *commandeer) handleBuildErr(err error, msg string) {
}
func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
+ if c.buildErr != nil {
+ ferrs := herrors.UnwrapFileErrorsWithErrorContext(c.buildErr)
+ for _, err := range ferrs {
+ events = append(events, fsnotify.Event{Name: err.Position().Filename, Op: fsnotify.Write})
+ }
+ }
c.buildErr = nil
visited := c.visitedURLs.PeekAllSet()
if c.fastRenderMode {