aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/rebuild_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-18 11:33:09 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-18 12:24:27 +0100
commitafe5b6d7dfa241137a2495699b3ce7f7e971e188 (patch)
treea15dd11d10f41b12bb496ba5e95dd87a46c3b90c /hugolib/rebuild_test.go
parent168d3757841d2064e11f8d122797e2771273d367 (diff)
downloadhugo-afe5b6d7dfa241137a2495699b3ce7f7e971e188.tar.gz
hugo-afe5b6d7dfa241137a2495699b3ce7f7e971e188.zip
Fix sample logic when adding content files in server
The partial rebuilds works by calaulating a baseline from a change set. For new content, this doesn't work, so to avoid rebuilding everything, we first try to collect a sample of surrounding identities (e.g. content files in the same section). This commit fixes a flaw in that logic that in some (many...) cases would return a too small sample set. Fixes #12054
Diffstat (limited to 'hugolib/rebuild_test.go')
-rw-r--r--hugolib/rebuild_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go
index f599d640d..d29215a01 100644
--- a/hugolib/rebuild_test.go
+++ b/hugolib/rebuild_test.go
@@ -261,6 +261,29 @@ func TestRebuilErrorRecovery(t *testing.T) {
b.EditFileReplaceAll("content/mysection/mysectionbundle/index.md", "{{< foo }}", "{{< foo >}}").Build()
}
+func TestRebuildAddPageListPagesInHome(t *testing.T) {
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+disableLiveReload = true
+-- content/asection/s1.md --
+-- content/p1.md --
+---
+title: "P1"
+weight: 1
+---
+-- layouts/_default/single.html --
+Single: {{ .Title }}|{{ .Content }}|
+-- layouts/index.html --
+Pages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$
+`
+
+ b := TestRunning(t, files)
+ b.AssertFileContent("public/index.html", "Pages: /p1/|$")
+ b.AddFiles("content/p2.md", ``).Build()
+ b.AssertFileContent("public/index.html", "Pages: /p1/|/p2/|$")
+}
+
func TestRebuildScopedToOutputFormat(t *testing.T) {
files := `
-- hugo.toml --