Closed noahdotpy closed 1 month ago
If you’re using multiple sources, you should also be using multiple configurations (or at least multiple state files). In Can chezmoi support multiple sources or multiple source states?, this example script is given:
chezmoi-apply() {
chezmoi apply --config ~/.config/chezmoi-home/chezmoi.toml \
--source ~/.local/share/chezmoi-home && \
chezmoi apply --config ~/.config/chezmoi-work/chezmoi.toml \
--source ~/.local/share/chezmoi-work
}
As it is, because you’re reusing the same state file, ~/.zshrc
is seen to be owned by whichever source you’re passing. I’m sure that the chezmoi state data could be extended to include the source path, but that would prevent the use of git work trees to switch between multiple versions of the same source, or relocating the source to a different location.
Closing this because I assume that the problem is solved. Please re-open if needed.
Describe the bug
I have a
~/.local/share/chezmoi
(let's call source 'b') that has the file~/.config/nushell/env.nu
and another source at~/.myublue/config/homefiles/common/
(let's call it source 'a'). I would dochezmoi apply
(using source a) usually. I have an automated script to chezmoi apply with source b. Source b has~/.config/nushell/env.nu
, the same file path as source a, with different contents. What happens is that~/.config/nushell/env.nu
gets overwritten by what chezmoi gets from source b. There are no extra flags other than--source
to change the source that chezmoi is getting it from.To reproduce
Make a test folder
Create two chezmoi repos inside this test folder. Add a dot_zshrc inside each repo, with file contents indicating which source it is from.
Then do this:
Notice how the contents of the .zshrc file is from source a
Then do the same command with source b:
Notice how the contents of the .zshrc file is from source b now, with no interactive prompt as would be expected if the .zshrc file was just there (not put there by chezmoi).
Expected behavior
A clear and concise description of what you expected to happen.
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Add any other context about the problem here.