Skip to content

feat: skip files git ignores when walking the repo - #7

Merged
webern merged 1 commit into
mainfrom
claude/funny-edison-xprjfp
Sep 23, 2026
Merged

webern merged 1 commit into
mainfrom
claude/funny-edison-xprjfp

Conversation

@webern

@webern webern commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Human Summary

Use the .gitignore to ignore files!

Summary

Deslag used to scan every Markdown file under the repo root, including build output and anything else git ignores. This PR replaces the hand-written directory walk in src/glob/walk.rs with the ignore crate's WalkBuilder. ignore is ripgrep's walker and comes from the same project as globset, which deslag already uses.

The walk now skips what git would skip: .gitignore files at any depth (negations included), .git/info/exclude, the global git excludes file, and .ignore files. Nothing else changes:

  • Hidden files and directories are still walked, since .github/ and .agents/ hold Markdown.
  • Symlinks are still not followed.
  • .git/ is still skipped.
  • The output is still RepoFiles sorted by relative path.

Two settings were chosen on purpose:

  • require_git(false): .gitignore applies even when there is no .git directory, as in an unpacked tarball or the test temp dirs.
  • parents(false): ignore files above the repo root are not read.

A broken ignore file or an unreadable directory now fails as a new Error::Walk, which names the path.

Testing

  • make ci: exit 0
  • New tests in tests/unit.rs: a gitignored directory, a nested .gitignore, a negation, and a hidden directory that is still scanned
  • docs/design/deslag.asbuilt.md updated for the new walk

References

@webern webern added the enhancement New feature or request label Sep 23, 2026 — with Claude
Replace the hand-written directory walk with the ignore crate's
WalkBuilder. It reads .gitignore at every depth, negations included,
.git/info/exclude, the global excludes file and .ignore, with git's
semantics. The rules apply without a .git directory. Hidden files are
still walked, symlinks are still not followed, and .git is still
skipped.

Closes #2
@webern
webern force-pushed the claude/funny-edison-xprjfp branch from fe37748 to 6065dad Compare September 23, 2026 16:01
@webern
webern merged commit cb24d05 into main Sep 23, 2026
2 checks passed
@webern
webern deleted the claude/funny-edison-xprjfp branch September 23, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observe .gitignore when globbing markdown files.

1 participant