A high-performance .NET glob library with gitignore compatibility.
- Compiled glob patterns with
*,?, character classes, escapes, and** - Git-compatible ignore parsing for
.gitignoreand.ignore - Repository-aware ignore matching with repository discovery and
core.ignorecasesupport - Low-allocation APIs for hot paths, including
ReadOnlySpan<char>overloads and reusable evaluators - Ignore-aware file tree walking with directory pruning and file metadata capture
- Differential tests against the Git CLI, with
net10+ and NativeAOT support
using XenoAtom.Glob.Git;
using XenoAtom.Glob.IO;
var repository = RepositoryDiscovery.Discover(@"C:\code\my-repo");
var walker = new FileTreeWalker();
// Walk the working tree while honoring the repository ignore rules.
foreach (var entry in walker.Enumerate(repository.WorkingTreeRoot, new FileTreeWalkOptions
{
RepositoryContext = repository,
}))
{
Console.WriteLine(entry.RelativePath);
}For more details on how to use XenoAtom.Glob, please visit the user guide.
GlobPattern,IgnoreRule,IgnoreRuleSet,IgnoreMatcher,RepositoryContext,FileTreeWalkOptions,FileTreeEntry, and parse/evaluation result values are immutable or internally synchronized and can be shared across threads.RepositoryDiscoveryis stateless and can be called concurrently.FileTreeWalkerinstances can start multiple concurrent traversals, but each returned enumeration should be consumed by only one thread at a time.IgnoreMatcherEvaluatoris intentionally reusable but not thread-safe. Create one evaluator per concurrent worker and dispose it when that worker is done.
This software is released under the BSD-2-Clause license.
Alexandre Mutel aka xoofx.
