mirror of
https://github.com/open-webui/oikb.git
synced 2026-11-05 01:27:25 +00:00
[PR #138] fix: let **/ match zero directories in filters and .oikbignore #129
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/oikb#129
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/oikb/pull/138
Author: @roydonsequeira
Created: 10/5/2026
Status: 🔄 Open
Base:
main← Head:fix/glob-double-star-zero-dirs📝 Commits (1)
f013516fix: let **/ match zero directories in filters and .oikbignore📊 Changes
3 files changed (+91 additions, -5 deletions)
View changed files
📝
src/oikb/ignore.py(+27 -2)📝
src/oikb/sync.py(+3 -3)➕
tests/test_ignore.py(+61 -0)📄 Description
Fixes #33.
build_manifest_filterand.oikbignoreboth match withfnmatch. Its*crosses/, but the/after**is still a literal, so**/needs at least one directory before it can match:So the patterns in the README and guide don't do what they read as:
include: ["**/*.md"](the config in #33) syncs every Markdown file except the ones at the top of the source.include: ["docs/**/*.md"], the README example, skipsdocs/index.mdand everything else directly indocs/.exclude: ["**/*.tmp"], and.oikbignorelines like**/*.tmpor**/archive/, never apply at the root.The filter runs on every connector's manifest, so this isn't specific to local directories.
glob_matchinoikb/ignore.pytries each pattern with every**/that starts the pattern or follows a/both kept and dropped, which is how gitignore reads it. The unchanged pattern is tried first, so everything that matched before still matches, including*crossing/(the Confluence tree filters such asFAQ*rely on that).**glued to other characters, as ina**/b, stays a plain*.Sources that use these patterns will see a one-off diff on their next sync: the top-level files they were missing get added, and top-level files their
excludeor.oikbignorenames get removed.Verification
FilesystemConnectoron the vault layout from #33, on main and on this branch:include: ["**/*.md"]: main dropsDocumentation-X.md,Note-Y.mdandReference-Z.md; this branch keeps all seven notes.include: ["docs/**/*.md"]: main keeps onlydocs/guide/setup.md; this branch also keepsdocs/index.md.exclude: ["**/*.tmp"]and.oikbignorewith**/*.tmp/**/archive/: main still syncsscratch.tmpandarchive/; this branch leaves them out.tests/test_ignore.pycovers the filter andshould_ignoreon that layout, plus cases that must not match (mydocs/index.mdfordocs/**/*.md,notes.mdxfor**/*.md,abfora**/b) and a pattern with two**/where only one spans a directory. The two behaviour tests fail on main. Full suite: 39 passed on main, 48 on this branch (Python 3.11).On a 50,000-entry manifest with three
**/patterns the filter takes about 0.4 s, up from 0.17 s.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.