Repository navigation
Replace the Rust glob matcher with a clean-room implementation - #2704
Conversation
glob_matches matches a glob pattern against text with git's semantics: `?`, `*`, a whole-folder `**`, bracket sets with ranges, negation and POSIX classes, `\` escapes, and options for treating `/` as a folder separator and ignoring ASCII case. It was written without reference to git's or any other implementation, only from the documented behaviour and git's matcher run as a black box. It parses the pattern into tokens, then tracks which text positions the pattern can reach, one token at a time, with no recursion or backtracking. It agrees with git on over 1.4 million random and exhaustive cases. Nothing calls it yet; the next commit switches over to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
The previous matcher, with its bracket-class and POSIX-class helpers, was a line-for-line port of git's wildmatch.c, which is under git's GPL v2 and can't be distributed under checksync's MIT licence. The gitignore matching now calls glob_matches instead, and the port is deleted. The gitignore pattern code that calls it is replaced next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
🦋 Changeset detectedLatest commit: 24f0939 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2704 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 93 106 +13
Lines 3177 3633 +456
Branches 2383 2840 +457
==========================================
+ Hits 3177 3633 +456
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
The Rust glob matcher (
wildmatch.rs, withmatch_bracket_class.rsandmatches_posix_class.rs) was a line-for-line port of git'swildmatch.c. That code is under git's GPL v2, so it can't ship under checksync's MIT licence.This replaces it with
glob_matches, a clean-room implementation. It was written by an agent that never saw git's code, any other glob implementation, or this repository's history. It worked only from the documented behaviour and from git's matcher run as a black box. The agent designed it from scratch:The gitignore matching now calls
glob_matches, and the port is deleted. The gitignore pattern code that calls it, which was ported from git'sdir.c, gets the same treatment in the next PR. Part of #2615.Test plan
glob_matchesagrees with git's matcher on about 950,000 random and exhaustive cases from the clean-room agent. Separately, I checked it against the 500,000 cases I'd used earlier for the old port. Every case agreed.ignore-vectors.jsonstill pass, now running through the new matcher.Generated by Claude Code