Skip to content

Consolidate the dual exclusion system (glob patterns + gitignore) into a single unified mechanism. #78

@oribarilan

Description

@oribarilan

Feature Request: Unified Exclusion Mechanism

Summary

Consolidate the dual exclusion system (glob patterns + gitignore) into a single unified mechanism.

Current State

  • exclude patterns: checked via glob pattern matching
  • exclude_gitignored: separate boolean flag with git ls-files check
  • Two different code paths in limits.lua:should_exclude_file()

Proposed Change

Merge gitignore content into the exclude patterns list during config setup:

limits = {
  exclude = { "node_modules/**", "dist/**" },        -- user patterns
  exclude_append = { "custom/**" },                  -- additional patterns  
  exclude_gitignored = true,                         -- load .gitignore into exclude list
}

Result: Single unified exclude list containing user patterns + gitignore patterns

Benefits

  • Simpler logic: One exclusion check instead of two
  • Better performance: No per-file git calls, single pattern matching
  • Consistent behavior: All exclusions work the same way
  • Easier testing: Single exclusion mechanism to test

Implementation

  1. During config setup, if exclude_gitignored = true, load gitignore files and append to exclude list
  2. Remove separate gitignore checking logic from limits.lua
  3. Use single matches_glob_pattern() check for all exclusions

Considerations

  • Breaking change: would need migration strategy
  • Gitignore patterns may need conversion to glob patterns
  • Cache invalidation when .gitignore changes

Metadata

Metadata

Assignees

Labels

techdebtWork needed to reduce technical debt, improve maintainability, refactor code, etc.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions