Skip to content

Add optional size limits for ignore files - #32

Merged
andrew merged 2 commits into
mainfrom
limit-ignore-file-size
Sep 13, 2026
Merged

Add optional size limits for ignore files#32
andrew merged 2 commits into
mainfrom
limit-ignore-file-size

Conversation

@andrew

@andrew andrew commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Add Options.MaxIgnoreFileSize through new WithOptions constructors and walk functions. Existing entrypoints remain unlimited, and AddPatterns is unaffected.

The limit applies to global excludes, repository excludes, and nested ignore files. Bounded reads prevent files that grow after the size check from exceeding the limit. Constructors skip oversized files and record them in Errors(); limited walks stop with an IgnoreFileSizeError containing the path and limit.

Fixes #29.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved blocking issues were identified.

Pull request overview

Adds optional per-file size limits for ignore files while preserving unlimited behavior for existing APIs.

Changes:

  • Adds MaxIgnoreFileSize options and bounded reads.
  • Integrates limits into constructors, nested discovery, and walks.
  • Documents behavior and adds coverage for limits and errors.
File summaries
File Summary
README.md Documents size-limit APIs and behavior.
options.go Implements options and bounded reads.
options_test.go Tests limits, diagnostics, and walks.
gitignore.go Integrates limits across loading and traversal.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit 67b7f6c into main Sep 13, 2026
7 checks passed
@andrew
andrew deleted the limit-ignore-file-size branch September 13, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt-in size limit for ignore files read from disk

2 participants