Skip to content

Apply .gitignore files above a path-table's scan start - #1278

Merged
thekevinscott merged 13 commits into
mainfrom
claude/1272-ancestor-gitignore
Oct 5, 2026
Merged

thekevinscott merged 13 commits into
mainfrom
claude/1272-ancestor-gitignore

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1272
Fixes #1296

A .gitignore applies to path-tables only inside a git repo, as in git, fd and ripgrep. With no enclosing .git, none applies: not at the index root, not above the scan start, not below it. A ~/.claude whose .gitignore is * now lists its files, from its root or by absolute path from its parent; after git init it lists nothing.

Inside a repo, a scan applies every .gitignore from the repo root (the nearest directory holding .git) down, including those above its starting directory, as git check-ignore does. './docs/*.log' and './**/z.log' now agree. A walk that enters a directory holding .git starts applying .gitignore files from there.

Naming a gitignored directory ('./dist') still scans it: ancestor rules filter the entries below the start, never the start itself.

The dirsql context guide (docs/context/usage.md, troubleshooting.md) and docs/reference/path-tables.md state the repo-only rule.

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass
  • TypeScript SDK e2e: pass
  • Rust core e2e (if applicable): pass (cargo test --workspace --features cli)
  • packages/python/e2e-attestations/<branch>.json receipt written if packages/python changed (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written if packages/ts changed (just e2e-attest-ts)
  • Command(s) run: cargo test --workspace --features cli, just e2e-attest-python, just e2e-attest-ts
  • Result summary: all pass (Python: 39 passed, 1 xfailed).

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package
  • Migration fragment with the same slug added under <root>/<pkg>/migrations.d/ for each changed package

Red: a path-table scan starting below the index root, or an index root inside a repo, ignores the .gitignore files above it.
Load every .gitignore from the nearest repo root, or the index root with no repo, down to the directory the scan starts in. The stat module now takes the index root, as the parsed module already did.
…gitignore

# Conflicts:
#	packages/rust/src/scanner.rs
#	testing-conventions.toml
@thekevinscott
thekevinscott merged commit 07d9f1c into main Oct 5, 2026
92 checks passed
@thekevinscott
thekevinscott deleted the claude/1272-ancestor-gitignore branch October 5, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants