-
Notifications
You must be signed in to change notification settings - Fork 501
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
chezmoi adds too many files #4223
Comments
There may be a bug in how |
What I think is happening here is: The initial state is that there are no files currently managed by chezmoi. When you run
you're asking to chezmoi to manage Since you specified the |
I think that makes sense, but:
Why does it need to manage The reason why I thought |
Because you specified
That isn't the way that chezmoi works. If you remove chezmoi considers its source tree as the source of truth for what gets written. It's generally cautious (so it will prompt if something has been changed since the last @twpayne Given what we've seen here, would it be fair to suggest that |
Apologies, I should've been more clear. What I mean to say is: if I deleted If I don't use Here's a quick example I did locally:
test/test.file is now gone conversely:
it isn't gone Unless I'm missing something here, I think the Perhaps there is a more proper way to achieve the above behaviour without |
The way that I would have said that would be …
It depends on what you want and on the programs you are using. Neovim is a little more respectful of the XDG "standard" than some programs, but there are a lot of programs (chezmoi included1) that break that with runtime files or have other files that you don't care to manage. With With respect to
Tom explained this above. Try this: mkdir -p ~/x/{y,z}/{a,b}
touch ~/x/z/{c,{a,b}/e}
chezmoi add --recursive --exact ~/x/z
chezmoi cd
find . -name '*x' When you do the last, you will see something like $ find home/exact_x
home/exact_x
home/exact_x/exact_z
home/exact_x/exact_z/exact_a
home/exact_x/exact_z/exact_a/empty_e
home/exact_x/exact_z/exact_b
home/exact_x/exact_z/exact_b/empty_e
home/exact_x/exact_z/empty_c You think that you’re just adding $ rm -rf home/exact_x ~/x
$ mkdir -p ~/x/{y,z}/{a,b}
$ touch ~/x/z/{c,{a,b}/e} ~/x/.keep
$ chezmoi add ~/x/.keep
$ chezmoi add --recursive --exact ~/x/z
$ chezmoi cd
$ find home/x
home/x
home/x/exact_z
home/x/exact_z/exact_a
home/x/exact_z/exact_a/empty_e
home/x/exact_z/exact_b
home/x/exact_z/exact_b/empty_e
home/x/exact_z/empty_c Which is what you expect. Therefore, if you want this, do the following: touch ~/.config/.keep
chezmoi add ~/.config/.keep
chezmoi add --recursive --exact ~/.config/nvim Footnotes
|
Having done a bit of experimentation above, I think that The output of |
What exactly are you trying to do?
I want to slowly start using chezmoi, eg initially using it for
~/.config/nvim/
onlyWhat have you tried so far?
I used the idea at the
oh-my-zsh
example at: https://www.chezmoi.io/reference/commands/add/#-i-include-types:chezmoi add ~/.config/nvim/ --exact --recursive
When I do that, chezmoi starts trying to manage my entire
~/.config
it seems:Consequently, when I do
chezmoi diff
, it wants to replace all of my files in other directories (aside from~/.config/nvim
) with null.Additional context
I suspect I'm doing something obviously wrong above, as it seems like a simple use case.
The issue doesn't happen if I don't use
--exact
, but presumably I do want that flag.May I suggest more examples in the quick start, and the add command, of adding entire directories to be managed with chezmoi? I'd think this is as common, if not more common, than adding individual files like
~/.zshrc
. But https://www.chezmoi.io/quick-start has no examples of whole directories, and theadd
command reference only has one (~/.oh-my-zsh
)The text was updated successfully, but these errors were encountered: