-
Notifications
You must be signed in to change notification settings - Fork 495
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
Trouble ignoring certain files #3780
Comments
I want to do the same. Did you find a solution to this? |
Running |
Was struggling with a similar issue. Essentially, the following does not work: *
!a/b/** You need *
!a/
!a/b/** |
This does feel like unexpected behaviour. I would expect the following to work, but I can confirm it causes all files to be ignored: *
!a/b/** |
I wanted to exclude a directory except for certain files and had a difficult time figuring out how to get it to work. Here's what I discovered. The chezmoiignore docs state it uses the Match function in the doublestar library. Match states a doublestar sandbox/**/
!sandbox/**/*.txt Removing the doublestar also does not work. sandbox/
!sandbox/**/*.txt Using the gitignore syntax to ignore a folder except certain files, I found this to work. sandbox/*
!sandbox/path1/
sandbox/path1/*
!sandbox/path1/sub1/
sandbox/path1/sub1/*
!sandbox/path1/sub2/
sandbox/path1/sub2/*
!sandbox/path1/sub3/
sandbox/path1/sub3/*
!sandbox/path2/
sandbox/path2/*
!sandbox/**/*.txt Adding the directory excludes other file types. ~/ $ chezmoi add ~/sandbox
chezmoi: warning: ignoring sandbox/path1/sub2/findme.bin
chezmoi: warning: ignoring sandbox/path1/sub3/findme.bin
chezmoi: warning: ignoring sandbox/path2/sub1
chezmoi: warning: ignoring sandbox/path2/sub2
chezmoi: warning: ignoring sandbox/path2/sub3
chezmoi: warning: ignoring sandbox/path3 And includes text files. This was run in the source directory. Notice the ~/.local/share/chezmoi/ $ fd --no-ignore --hidden . sandbox/
sandbox/path1/
sandbox/path1/sub1/
sandbox/path1/sub1/text1.txt
sandbox/path1/sub2/
sandbox/path1/sub2/text1.txt
sandbox/path1/sub3/
sandbox/path1/sub3/text1.txt
sandbox/path2/
sandbox/path2/.keep For completeness, here's the target structure. ~/ $ fd --no-ignore --hidden . sandbox/
sandbox/path1/
sandbox/path1/sub1/
sandbox/path1/sub1/text1.txt
sandbox/path1/sub2/
sandbox/path1/sub2/findme.bin
sandbox/path1/sub2/text1.txt
sandbox/path1/sub3/
sandbox/path1/sub3/findme.bin
sandbox/path1/sub3/text1.txt
sandbox/path2/
sandbox/path2/sub1/
sandbox/path2/sub1/text1.txt
sandbox/path2/sub2/
sandbox/path2/sub2/text1.txt
sandbox/path2/sub3/
sandbox/path2/sub3/findme.bin
sandbox/path2/sub3/text1.txt
sandbox/path3/
sandbox/path3/sub1/
sandbox/path3/sub1/text1.txt
sandbox/path3/sub2/
sandbox/path3/sub2/text1.txt
sandbox/path3/sub3/
sandbox/path3/sub3/findme.bin
sandbox/path3/sub3/text1.txt My real-world use case has a lot more sub-directories which makes this cumbersome but it works. |
What exactly are you trying to do?
I have the following layout for my tmux config
and plugins contains
I want add the whole tmux directory and the
tpm
plugin but ignore any future plugins as they will be installed bytpm
. That was it makes it more manageable.What have you tried so far?
I've added the following
~/.local/share/chezmoi/.chezmoiignore
Describe what you have tried so far.
Where else have you checked for solutions?
Looked at issues using chezmoiignore #1237 chore: Add test for ignoring directories #1942
Output of any commands you've tried with
--verbose
flagThe output of the add looks ok to me all plugins except
tpm
ignored however themanaged
command shows no filesAdding files separately works
However I can't then add plugins (which I would expect to add the
tpm
folder) unless mt assumption is incorrectOutput of
chezmoi doctor
Additional context
BTW I love the project and it's been amazing to sync my systems and help would be appreciated.
What I was looking for was a way to
re-add
in future without having to manually choose what to add. For examplechezmoi re-add -r ~/.config/tmux
The text was updated successfully, but these errors were encountered: