mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
Fix rebuilds when running hugo -w
This was partly broken in Hugo 0.123.0. We have two internal config options that gets set from the CLI: * Running; a web server is running * Watching; either set via `hugo -w` or `hugo server --watch=false` Part of the change detection code wrongly used the `Running` as a flag when `Watching` would be the correct. Fixes #12296
This commit is contained in:
@@ -38,12 +38,20 @@ import (
|
||||
|
||||
type TestOpt func(*IntegrationTestConfig)
|
||||
|
||||
// TestOptRunning will enable running in integration tests.
|
||||
func TestOptRunning() TestOpt {
|
||||
return func(c *IntegrationTestConfig) {
|
||||
c.Running = true
|
||||
}
|
||||
}
|
||||
|
||||
// TestOptWatching will enable watching in integration tests.
|
||||
func TestOptWatching() TestOpt {
|
||||
return func(c *IntegrationTestConfig) {
|
||||
c.Watching = true
|
||||
}
|
||||
}
|
||||
|
||||
// Enable tracing in integration tests.
|
||||
// THis should only be used during development and not committed to the repo.
|
||||
func TestOptTrace() TestOpt {
|
||||
@@ -570,6 +578,10 @@ func (s *IntegrationTestBuilder) initBuilder() error {
|
||||
"running": s.Cfg.Running,
|
||||
"watch": s.Cfg.Running,
|
||||
})
|
||||
} else if s.Cfg.Watching {
|
||||
flags.Set("internal", maps.Params{
|
||||
"watch": s.Cfg.Watching,
|
||||
})
|
||||
}
|
||||
|
||||
if s.Cfg.WorkingDir != "" {
|
||||
@@ -817,6 +829,11 @@ type IntegrationTestConfig struct {
|
||||
// Whether to simulate server mode.
|
||||
Running bool
|
||||
|
||||
// Watch for changes.
|
||||
// This is (currently) always set to true when Running is set.
|
||||
// Note that the CLI for the server does allow for --watch=false, but that is not used in these test.
|
||||
Watching bool
|
||||
|
||||
// Will print the log buffer after the build
|
||||
Verbose bool
|
||||
|
||||
|
Reference in New Issue
Block a user