Skip to content

Pass patterns to git grep one per line; bump to 1.5.0 - #7

Merged
Ron Gutierrez (rongutierrez) merged 1 commit into
masterfrom
rg_add_regexes
Oct 21, 2026
Merged

Ron Gutierrez (rongutierrez) merged 1 commit into
masterfrom
rg_add_regexes

Conversation

@rongutierrez

@rongutierrez Ron Gutierrez (rongutierrez) commented Oct 21, 2026 •

Copy link
Copy Markdown

Issue #, if available: N/A

Description of changes:

git_grep (used by the pre-commit hook and --scan with --cached/--untracked/--no-index) joined every configured pattern into one big a|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:

Staged content Single alternation (before) git grep -f - (after)
5 KB 1.5s 0.2s
20 KB (typical commit) 4.5s (36s with the full unpruned gitleaks set) 0.4s
200 KB ~45s (est.) 2.7s

This change pipes the patterns to git grep -f - so each one is compiled and matched separately. regular_grep already passes patterns one per line, so both scan paths now behave the same way. Patterns go through printf '%s\n' so backslashes or a leading -e in a pattern can't be mangled.

The version is bumped to 1.5.0

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>
@rongutierrez
Ron Gutierrez (rongutierrez) merged commit f8e064d into master Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant