]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
server: Always rebuild the files involved in an error
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 12 May 2022 09:18:18 +0000 (11:18 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 14 May 2022 11:40:56 +0000 (13:40 +0200)
Fixes #9884

commands/hugo.go

index c13fdce06048bae00869733f904c85c5be7a3acb..ada1e1cef547ad18f046723b4268c430c04f0e14 100644 (file)
@@ -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 {