Open twpayne opened 3 years ago
@twpayne I would like to point out something here: Issue #2006 and issue #1574 (this issue) have somewhat similarity but still I believe they are different.
In issue #2006 I had .config/nvim
being managed by .chezmoiexternal
and I was trying to add .config/direnv
(a separate) directory. Thus I was getting error:
chezmoi: mkdir /home/ds/.local/share/chezmoi/dot_config/direnv: no such file or directory
But here in this case, .chezmoiexternal
is managing .oh-my-zsh
and .oh-my-zsh/custom/plugins/zsh-syntax-highlighting
. And when trying to add .oh-my-zsh/custom/aliases.zsh
(same root as one of the .chezmoiexternal) chezmoi give below erro:
chezmoi: stat /home/ds/.local/share/chezmoi/https:/github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz: no such file or directory
I tried few test and it seems that workaround only works if mkdir
error persists. But in case of state
error then workaround does not work and which made me believe that #2006 and this issue are different.
When this issue is fixed, we should also update the docs to include Felipe's neat trick in this comment.
This also applies to files. See https://github.com/twpayne/chezmoi/issues/3559#issuecomment-1951430262.
Adding the workaround reference here, as this issue seems more prominent. Mentioned in https://github.com/twpayne/chezmoi/issues/2006#issuecomment-1099130392
Temporary work around applied:
Manually create a dot_config directory and within that directory touch .keep to force chezmoi to track it.
now using chezmoi add ~/.config/direnv/direnvrc works as expected.
In addition to this you'll need to make your externals exact = false
in the externals toml that conflict. Eg: .chezmoiexternal.toml
[".oh-my-zsh"]
type = "archive"
url = "https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz"
exact = false
stripComponents = 1
Describe the bug
As reported by @dhruvinsh in #1205,
chezmoi add
fails if the path is in a directory implicitly created by an external.To reproduce
Expected behavior
chezmoi add
adds the file.