Skip to content
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

fix: Fix externals not being ignored by .chezmoiignore #3197

Conversation

stablestud
Copy link

fixes #3196

@stablestud
Copy link
Author

Tests failing due to changed patterns, need help in adjusting them, as I don't see through which one exactly has failed

@stablestud stablestud force-pushed the fix/externals-ignore-chezmoiignore branch from 1c966cb to e7aa663 Compare August 27, 2023 14:45
@@ -1403,6 +1403,9 @@ func (s *SourceState) addPatterns(
include = patternSetExclude
}
pattern := dir.JoinString(text).String()
if !strings.HasSuffix(pattern, "/**") {
pattern = pattern + "/**"
Copy link
Author

@stablestud stablestud Aug 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fix is appropriate (if no better solution exists) we might discuss where to put this pattern extension (/**).
It can be put either here, only being applying on source state reads or directly into patternset.go#Match effecting all dependent "packages".

Copy link
Author

@stablestud stablestud Aug 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually prefer to put it into patternset.go#Match as the behavior of doublestar is strange and unexpected for ignoring files (.config/i3 does not match .config/i3/theme.conf)

@bradenhilton
Copy link
Collaborator

@twpayne
Copy link
Owner

twpayne commented Aug 27, 2023

This change is not correct. chezmoi explicitly treats the patterns dir/ and dir/** differently so you can ignore a directory but not its contents. This behavior is different to .gitignore which does not allow such a distinction.

@stablestud stablestud force-pushed the fix/externals-ignore-chezmoiignore branch from e7aa663 to ae55c1e Compare August 27, 2023 15:06
@stablestud
Copy link
Author

@twpayne please see the corresponding issue #3196 why I created this change

@twpayne
Copy link
Owner

twpayne commented Aug 27, 2023

I saw the issue. It is not a bug. This change will break everybody who relies on chezmoi's existing behavior.

@stablestud
Copy link
Author

Then this can be closed

@stablestud stablestud closed this Aug 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External files not being ignored when in sub directory of .chezmoiignore entry
3 participants