[#52] Sync → Ignore patterns - #70
Open
kwame-Owusu wants to merge 14 commits into
Open
Conversation
Contributor
|
@kwame-Owusu Thanks for the PR, will leave this for after the |
Contributor
Author
Cool 👍 |
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.
Resolves #52
Feature
There's no way to exclude a folder or file pattern from sync, every file the vault reader sees becomes a candidate for push or pull. Users will want to keep some folders local only (a private notes folder, a large attachments folder) without excluding them from Obsidian entirely.
Needs a settings field for glob style ignore patterns, applied before takeSnapshot/planSync ever sees those paths.
Changes
Added the ability to exclude files and folders from sync via two layers:
local_convention, any path segment starting withlocal_is always excluded from sync, no configuration neededFiltering happens at the vault reader level so ignored files never enter the snapshot system. Previously-synced files that become ignored will appear as deletions and be cleaned from remote on next sync.
UI
Look of the UI in the settings tab for geod, users will be able to add their glob style patterns line by line. Similar to how we do in a .gitignore file.
Tests
Added new tests in
ignore.test.ts, and they all passGreptile Summary
This PR adds file/folder exclusion from sync via two layers: a built-in
local_path-segment convention and user-configurable glob patterns editable in a new Sync section of the settings tab. Filtering is applied insidecreateObsidianReaderso ignored paths never enter the snapshot pipeline; previously-synced files that match a new pattern appear as local deletions and are cleaned from remote on the next sync pass.src/ignore.tsmodule implementshasLocalPrefix, a glob-to-regex compiler, and both a per-call (shouldIgnore) and pre-compiled (shouldIgnoreCompiled/compilePatterns) API; companionignore.test.tscovers edge cases thoroughly.ignorePatterns: string[]field with default[], proper coercion innormalizeSettings, and anarraysEqualhelper wired intosettingsEqual.setDescargument and includes theprivate/**folder hint.Confidence Score: 5/5
Safe to merge — the ignore logic is correct, filtering happens before any file enters the snapshot, and the settings round-trip is validated end-to-end.
The core filtering logic is sound: shouldIgnore is called inside listFiles so ignored paths never reach takeSnapshot or planSync. Both the per-call and pre-compiled variants are exported and tests cover all documented glob forms. Settings persistence and equality checks are correct. Two issues flagged in earlier review rounds were partially or fully addressed in this diff.
Files Needing Attention: src/vault/obsidian.ts — listFiles still calls shouldIgnore (which recompiles patterns per file) rather than the exported compilePatterns/shouldIgnoreCompiled pair; noted in a previous review thread.
Important Files Changed
Reviews (9): Last reviewed commit: "Merge branch 'main' into feat/ignore-pat..." | Re-trigger Greptile