Repository navigation
lib/ignore: Keep skipping ignored dirs for rooted patterns - #6151
Merged
Merged
Conversation
golangcibot
reviewed
Nov 12, 2019
golangcibot
reviewed
Nov 14, 2019
calmh
reviewed
Nov 24, 2019
| return false | ||
| } | ||
| // need to check for escapes | ||
| for i := strings.Index(comp, "["); i != -1; i = strings.Index(comp[i+1:], "[") { |
Member
There was a problem hiding this comment.
There are also ? wildcards and {bracketed,alternatives}, should we check for those?
Also escapes are not processed on Windows, so \[foo] there is a rooted path with a wildcard expression in it...
Member
Author
There was a problem hiding this comment.
I really shouldn't handle this globbing stuff manually...
I switched to using glob.QuoteMeta to check for any "special stuff". That has the limitation that it doesn't work with escaped brackets \[. So this optimization will not apply to any include patterns with such in them.
calmh
previously approved these changes
Nov 25, 2019
Member
|
I'd like to have a better look at this in front of a bigger screen |
AudriusButkevicius
approved these changes
Nov 25, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This came up a few times, most recently here: https://forum.syncthing.net/t/how-to-correctly-exclude-all-files-and-folders-except-folder-abc-and-def/14062
For most include patterns we need to traverse everything to catch them, but for rooted patterns without wildcards in all but the last part of the path we don't actually.
Testing
To test this I needed to refactor to have a function that creates patterns from lines/strings instead of files/readers.