Fix hooks hanging on repos with nested gitignored git repos#27
Merged
JordanCoin merged 1 commit intoJordanCoin:mainfrom Feb 21, 2026
Merged
Fix hooks hanging on repos with nested gitignored git repos#27JordanCoin merged 1 commit intoJordanCoin:mainfrom
JordanCoin merged 1 commit intoJordanCoin:mainfrom
Conversation
Two fixes: 1. scanner/astgrep.go: ScanDirectory now detects subdirectories with their own .git and passes --globs exclusions to ast-grep so it doesn't scan them. Previously ast-grep treated nested .git dirs as separate repo boundaries, ignoring the parent .gitignore and scanning thousands of files indefinitely. 2. cmd/hooks.go: findChildRepos now uses git check-ignore to skip gitignored child repos. Previously it would run full codemap trees on massive ignored directories like vendored dependencies.
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.
Summary
scanner/astgrep.go:ScanDirectorynow detects subdirectories containing their own.gitand passes--globs '!dir/**'exclusions to ast-grep. Previously, ast-grep treated nested.gitdirs as separate repo boundaries, ignoring the parent.gitignoreand scanning thousands of files indefinitely.cmd/hooks.go:findChildReposnow usesgit check-ignoreto skip gitignored child repos. Previously it would run full codemap trees on massive ignored directories.Problem
In repos that contain large gitignored subdirectories with their own
.git(e.g. a clonedfreerdp/with 3,600+ files), bothcodemap hook prompt-submitandcodemap hook session-starthang indefinitely. This completely blocks Claude Code —/resumestops working since theUserPromptSubmithook never returns.Root cause
ScanForDeps→ast-grepscans the entire root directory. When it hits a nested.git, it treats it as a separate repo boundary and ignores the parent's.gitignore, scanning all files in that subdirectory.findChildReposdoesn't check.gitignore, sohookSessionStartMultiReporuns full codemap trees on gitignored repos.Test plan
codemap hook prompt-submitcompletes instantly (was hanging forever)codemap hook session-startcompletes instantly (was timing out at 15s+)freerdp/,openssl-src/) are properly excluded