Sync → Ignore patterns#70
Open
kwame-Owusu wants to merge 13 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.
Test Plan
Added new tests in
ignore.test.ts, and they all passGreptile Summary
This PR adds ignore-pattern support to vault sync. Files are filtered at the
listFileslayer increateObsidianReader, so ignored paths never enter the snapshot system and previously-synced files that become ignored appear as local deletions on the next sync run.src/ignore.ts— new pure module implementinghasLocalPrefix(built-inlocal_convention),globToRegex,compilePatterns,shouldIgnoreCompiled, and the convenience wrappershouldIgnore; well-tested with table-driven cases inignore.test.ts.src/settings/—ignorePatterns: string[]added toGeodeSettingswith astringArrayOrnormalizer,arraysEqualhelper wired intosettingsEqual, and arenderSyncSectiontextarea in the settings tab that splits/trims/filters user input on change.src/vault/obsidian.tsandsrc/main.ts—createObsidianReaderupdated to accept and apply the patterns; both call-sites passthis.settings.ignorePatterns, which is updated synchronously bysave()before any subsequent sync.Confidence Score: 5/5
Safe to merge; filtering is correctly applied at the reader layer and all call-sites pass live settings.
The core filtering logic in ignore.ts is well-covered by unit tests, the two createObsidianReader call-sites in main.ts both use the updated signature, and settingsEqual is correctly extended for array comparison. The only open items are a style nit on a function comment and a minor performance opportunity in obsidian.ts, neither of which affects correctness.
No files require special attention beyond the two inline comments already left.
Important Files Changed
Reviews (8): Last reviewed commit: "Merge branch 'main' into feat/ignore-pat..." | Re-trigger Greptile