docs(stignore): add pattern ordering note and common pitfalls section#999
Open
hrubymar10 wants to merge 1 commit intosyncthing:mainfrom
Open
docs(stignore): add pattern ordering note and common pitfalls section#999hrubymar10 wants to merge 1 commit intosyncthing:mainfrom
hrubymar10 wants to merge 1 commit intosyncthing:mainfrom
Conversation
Document that !/dir auto-expands to also include !/dir/**, and that specific ignore patterns must come before the broad !/dir whitelist to avoid the auto-expansion shadowing them. Add a Common Pitfalls section with a practical .git example showing both wrong and correct pattern ordering.
Member
|
Just a comment, but What I mean is that |
Member
|
I think this writeup over-complicates and confuses, honestly, by explaining implementation details like expanded patterns and whatnot. There are two principles that need to be followed & understood:
Point number two is kind of obvious really, it would be impossible for the ignore pattern |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consider merging this. It took me hours to figure out why my ignore patterns weren't working, and I was only able to understand the issue after analysing the actual source code. It's definitely up to you whether you want to accept this — I just thought it could help some future people who hit the same wall. And yes, both the text in this PR and the documentation changes are AI-generated, but believe me there is a human with intent behind it who verified everything before opening this PR.
Summary
!/dirauto-expands to also unignore!/dir/**, and that this affects pattern ordering.gitexample showing both incorrect and correct pattern orderingMotivation
Users commonly write
.stignorepatterns in an intuitive but incorrect order — broad whitelist first (!/mydir), then specific exclusions after (/mydir/**/.git/**). This fails silently because Syncthing uses first-match-wins and auto-expands directory unignore patterns. The current documentation doesn't warn about this ordering requirement.This is especially common when syncing home directories or project folders while trying to exclude
.gitinternals,node_modules, etc.Changes
!/dircreates an implicit!/dir/**and links to the pitfalls section