-
Notifications
You must be signed in to change notification settings - Fork 486
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
Templated files are NOT processed independently of each other #3126
Comments
Note that I found that I could avoid the problem by switching the order of the two merge arguments in the |
This is because you are using the
You need to use |
Sure, that avoids the problem but isn't it problematic that chezmoi generates different results for the same target depending on which files it's applied to? With my example, running Users could still shoot themselves in the foot, for example by calling two templates with |
You're right. The template execution should be independent. Should be fixed with #3129. Thank you for spotting and reporting this :) |
Describe the bug
Any modification to the . dictionary done while processing a templated file is visible in the processing of further templated files. The processing of each templated file should start with an unmodified . dictionary.
To reproduce
File
chezmoi/.chezmoitemplates/file.txt
:File
chezmoi/file1.txt.tmpl
:File
chezmoi/file2.txt.tmpl
:Note that
file2.txt
containsfile1
.Now
file2.txt
containsfile2
.And it's back to
file1
!?!Expected behavior
The file
file2.txt
should always containfile2
.Output of
chezmoi doctor
The text was updated successfully, but these errors were encountered: