Fix list_vault leaking .git/objects into results

rglob walks into .git/ before the name-check on .git itself fires.
Files under .git/objects/ have normal names so the entry-level filter
didn't stop them. Added ancestor-path check that skips any entry with
a hidden (dot-prefixed) directory anywhere in its path.

The result was a 566K-char blob that blew past the model's 32K context.
This commit is contained in:
helm 2026-07-07 01:43:08 -04:00
parent 31a288933f
commit c1cb15cb3b

View file

@ -201,6 +201,15 @@ def list_vault(
continue
if entry.name in OBSIDIAN_HIDDEN and not str(entry.resolve()).startswith(str(vault / ".obsidian")):
continue
# Also skip entries nested inside any hidden/excluded directory ancestor
# (e.g. .git/objects/ab/cdef — the file name looks innocent but it lives
# under .git, which rglob walks into before we can stop it)
rel = entry.relative_to(vault)
if any(
part.startswith(".") and part != ".obsidian"
for part in rel.parts
):
continue
info = _file_info(entry, vault)
if entry.is_dir():