shithub: hugo

Download patch

ref: bf5f10faa9fd445c4dd21839aa7d73cd2acbfb85
parent: 019bd5576be87c9f06b6a928ede1a5e78677f7b3
author: Bjørn Erik Pedersen <[email protected]>
date: Tue Jun 5 06:05:20 EDT 2018

Reset the "distinct error logger" on rebuilds

Fixes #4818

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -670,7 +670,6 @@
 func (c *commandeer) initSites() error {
 	if c.hugo != nil {
 		c.hugo.Cfg = c.Cfg
-		c.hugo.Log.ResetLogCounters()
 		return nil
 	}
 
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -280,6 +280,14 @@
 	}
 }
 
+// resetLogs resets the log counters etc. Used to do a new build on the same sites.
+func (h *HugoSites) resetLogs() {
+	h.Log.ResetLogCounters()
+	for _, s := range h.Sites {
+		s.Deps.DistinctErrorLog = helpers.NewDistinctLogger(h.Log.ERROR)
+	}
+}
+
 func (h *HugoSites) createSitesFromConfig() error {
 	oldLangs, _ := h.Cfg.Get("languagesSorted").(helpers.Languages)
 
--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -131,6 +131,7 @@
 		s.resetBuildState()
 	}
 
+	h.resetLogs()
 	helpers.InitLoggers()
 
 	return nil