ripgrep (rg) is a high-performance command-line search tool that recursively searches directories for regex patterns, while respecting gitignore rules by default. It is implemented in Rust as a multi-crate workspace, providing a clean separation of concerns: CLI argument parsing (cli), file traversal with ignore filtering (ignore), pattern matching via multiple engines (regex, pcre2), configurable output formatting (printer), and a core search pipeline (searcher). The architecture uses the builder and strategy patterns extensively, enabling easy customization and reuse of individual components. Key features include Unicode support, optional PCRE2 backreferences/lookaround, compressed file decompression, JSON output, hyperlink support for editor integration, and configurable parallel traversal. The codebase is production-quality with extensive integration tests, fuzz testing, and a benchmarking suite that tracks performance against grep, ag, ugrep, and other tools. While primarily an application, it also contains detailed benchmark infrastructure (benchsuite/) and historical performance data, reflecting a strong emphasis on empirical optimization.
Symfony Finder is a mature PHP library that locates files and directories through a fluent, rules-based API. The implementation is not a monolithic filesystem walker but a composition of small SPL iterator decorators: Finder::getIterator() builds a pipeline containing RecursiveDirectoryIterator, ExcludeDirectoryFilterIterator, depth/type/name/content/size/date filters, custom callbacks, and optional gitignore filtering. Multiple search roots are merged lazily through AppendIterator, and sorting is applied only when requested via SortableIterator. The library also exposes standalone, dependency-free pattern compilers, Glob::toRegex() and Gitignore::toRegex(), which translate glob and gitignore syntax into PCRE strings.
node-ignore is a pure JavaScript library that implements the .gitignore specification (2.22.1) for filtering file paths according to ignore rules. It is used by major tools like ESLint and GitBook. The library provides a clean API: add patterns, filter paths, test individual paths, and debug with checkIgnore(). Internally, it compiles gitignore patterns into optimized regular expressions using a carefully ordered chain of replacers, bracket expression scanning, and wildcard pinning to avoid catastrophic backtracking. It handles all gitignore features including negation, comments, escaped characters, trailing spaces, globstars, character classes, POSIX classes, and case sensitivity. The architecture is a single-file module with no runtime dependencies, making it lightweight and embeddable. Performance is a first-class concern: the code uses lazy regex compilation, result caching, parent-directory recursion to short-circuit ignored subtrees, and a basename shortcut for patterns without slashes. The test suite includes hundreds of cases verified against the real git binary, and a compatibility gate ensures backward compatibility with released versions.
This repository is a curated collection of .gitignore file templates for a wide range of programming languages, frameworks, editors, and operating systems. It serves as the source for GitHub's built-in .gitignore template chooser when creating new repositories. The repository is organized into root-level templates for common technologies, a Global/ directory for editor/OS-specific rules, and a community/ directory for specialized or versioned templates. Each file is a self-contained list of file patterns to exclude from version control, following best practices for the respective technology. The templates are maintained through community contributions and a stale PR workflow. While the repository contains no executable code, its value lies in the curated, accurate, and up-to-date ignore rules that help developers avoid committing unnecessary or sensitive files.