Repository navigation
Pass patterns to git grep one per line; bump to 1.5.0 - #7
Merged
Merged
Conversation
git_grep joined every pattern into a single alternation. Apple git's regex engine slows down sharply as one alternation grows: with ~160 patterns (the gitleaks-derived set the Jamf installer is about to deploy), a 20 KB pre-commit scan took over 30 seconds. Feeding the patterns with `git grep -f -` keeps them separate and brings that down to well under a second. regular_grep already passes patterns one per line. Bump the version to 1.5.0 so the Jamf installer can pin a release that includes this fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: N/A
Description of changes:
git_grep(used by the pre-commit hook and--scanwith--cached/--untracked/--no-index) joined every configured pattern into one biga|b|c|…alternation. Apple git's regex engine slows down sharply as a single alternation grows. With the ~160 patterns scanning staged content got very slow:git grep -f -(after)This change pipes the patterns to
git grep -f -so each one is compiled and matched separately.regular_grepalready passes patterns one per line, so both scan paths now behave the same way. Patterns go throughprintf '%s\n'so backslashes or a leading-ein a pattern can't be mangled.The version is bumped to 1.5.0