Skip to content

Comments

Fix hooks hanging on repos with nested gitignored git repos#27

Merged
JordanCoin merged 1 commit intoJordanCoin:mainfrom
korboybeats:main
Feb 21, 2026
Merged

Fix hooks hanging on repos with nested gitignored git repos#27
JordanCoin merged 1 commit intoJordanCoin:mainfrom
korboybeats:main

Conversation

@korboybeats
Copy link
Contributor

Summary

  • scanner/astgrep.go: ScanDirectory now detects subdirectories containing their own .git and passes --globs '!dir/**' exclusions to ast-grep. Previously, ast-grep treated nested .git dirs as separate repo boundaries, ignoring the parent .gitignore and scanning thousands of files indefinitely.
  • 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.

Problem

In repos that contain large gitignored subdirectories with their own .git (e.g. a cloned freerdp/ with 3,600+ files), both codemap hook prompt-submit and codemap hook session-start hang indefinitely. This completely blocks Claude Code — /resume stops working since the UserPromptSubmit hook never returns.

Root cause

  1. ScanForDepsast-grep scans 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.
  2. findChildRepos doesn't check .gitignore, so hookSessionStartMultiRepo runs full codemap trees on gitignored repos.

Test plan

  • Verified codemap hook prompt-submit completes instantly (was hanging forever)
  • Verified codemap hook session-start completes instantly (was timing out at 15s+)
  • Verified gitignored child repos (freerdp/, openssl-src/) are properly excluded
  • Verified non-ignored child repos still appear in multi-repo context

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.
@JordanCoin JordanCoin merged commit 24b06bd into JordanCoin:main Feb 21, 2026
12 checks 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.

2 participants