Skip to content

Commit

Permalink
server: Always rebuild the files involved in an error
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 13, 2022
1 parent 6e5879f commit 09605d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 09605d8

Please sign in to comment.