summaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-02-28 12:39:58 +0100
committerBjørn Erik Pedersen <[email protected]>2020-02-28 14:14:55 +0100
commitb0d850321e58a052ead25f7014b7851f63497601 (patch)
tree259c88911dc10eb7264fec17725357a97fd0b7a4 /hugolib
parentb66d38c41939252649365822d9edb10cf5990617 (diff)
downloadhugo-b0d850321e58a052ead25f7014b7851f63497601.tar.gz
hugo-b0d850321e58a052ead25f7014b7851f63497601.zip
Fix rebuild logic when editing template using a base template
We have been doing too much work in that case. Fixes #6968
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/hugo_sites_rebuild_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/hugolib/hugo_sites_rebuild_test.go b/hugolib/hugo_sites_rebuild_test.go
index eca6c730b..1f0b1b5d9 100644
--- a/hugolib/hugo_sites_rebuild_test.go
+++ b/hugolib/hugo_sites_rebuild_test.go
@@ -15,6 +15,8 @@ package hugolib
import (
"testing"
+
+ qt "github.com/frankban/quicktest"
)
func TestSitesRebuild(t *testing.T) {
@@ -142,6 +144,29 @@ Data Inline: Rules!`)
})
+ // https://github.com/gohugoio/hugo/issues/6968
+ t.Run("Edit single.html with base", func(t *testing.T) {
+ b := newTestSitesBuilder(t).Running()
+
+ b.WithTemplates(
+ "_default/single.html", `{{ define "main" }}Single{{ end }}`,
+ "_default/baseof.html", `Base: {{ block "main" .}}Block{{ end }}`,
+ )
+
+ b.WithContent("p1.md", "---\ntitle: Page\n---")
+
+ b.Build(BuildCfg{})
+
+ b.EditFiles("layouts/_default/single.html", `Single Edit: {{ define "main" }}Single{{ end }}`)
+
+ counters := &testCounters{}
+
+ b.Build(BuildCfg{testCounters: counters})
+
+ b.Assert(int(counters.contentRenderCounter), qt.Equals, 0)
+
+ })
+
t.Run("Page.Render, edit baseof", func(t *testing.T) {
b := createSiteBuilder(t)