-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not watch directories with no mounted files in it #12912
Comments
bep
added
Enhancement
NeedsUserFeedback
Bug
and removed
Bug
NeedsTriage
Enhancement
NeedsUserFeedback
labels
Oct 9, 2024
bep
changed the title
Excessive recursion in 'hugo server' file watcher
Do not watch directories with no mounted files in it
Oct 9, 2024
I guess this somehow relates to ... #12918 One workaround you don't mention is to ... move the directories to a more ... traditional setup. |
OK, looking at fcdc454 -- that doesn't actually solve this particular issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Hugo are you using (
hugo version
)?v0.135.0+extended
Does this issue reproduce with the latest release?
Yes
Issue
In trying to migrate an existing site to Hugo, I believe I found a bug in the file watcher of the built-in test server.
Direct migration involves a directory structure that does not match the default Hugo directory structure. In particular, content is hosted in the root directory (and subdirectories) while metadata and configuration are stored in a specially named subdirectory under the root, which I'll name
hugo
in this example. The following tree describes this structure and is sufficient to reproduce this issue:This directory structure can be configured with the mounts module in a minimal
hugo.toml
file:When building the site from within the
hugo
directory, everything works as expected. There are no warnings/errors and thepublic
directory is fully populated with the expected content. However, when using thehugo server
command, the process will sometimes bring up the server after many errors, sometimes hang, and sometimes crash. The example output included at the end of this issue seems to imply that the file watcher notices as output is added to the output directory and triggers continuous rebuilds.I believe that the
excludeFiles
option for the mounts module works correctly for excluding content from the content-building system, but does not exclude files from the file watcher in the built-in test server.Workarounds
Including
disableWatch = true
in the mount definition fixes this issue at the expense of disabling automatic rebuilds while the server is running.Alternatively, including a top-level option of
ignoreFiles = ['/hugo/.*$']
seems to fix this issue with configuration redundancy being the only downside. This is a perfectly acceptable workaround for my situation, but I thought I should raise this issue as the include/exclude options in the mounts module seem to be preferred over the globalignoreFiles
option in the project's documentation.Example output (
hugo server
)This particular invocation never terminated.
The text was updated successfully, but these errors were encountered: