Repository navigation
fix(cli): hooks allow in a directory outside any git repository - #109
Merged
Merged
Conversation
A session started in a plain directory had every Bash, Edit and Write blocked by gate-guard: resolving the main repo failed with git's "not a git repository", which surfaced as a generic store error and gate hooks read that as "the store cannot be read" and failed closed. Outside a repo there is no main repo to key a store to, so there is no store — the same answer as a repo without one — and hooks allow. gitutil now tells that git answer apart (ErrNotARepository) and StorePath maps it to ErrNoStore. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XpCG85waNcdZjvMQE82QfT
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe change classifies Git’s non-repository error as ChangesNon-repository store handling
Estimated code review effort: 2 (Simple) | ~10 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
justinjdev
enabled auto-merge
September 6, 2026 19:47
justinjdev
disabled auto-merge
September 6, 2026 19:47
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.
Found by the first local smoke test of #108: a Claude Code session started in a plain directory (not inside any git repository) had every Bash, Edit and Write call blocked by
gate-guardwith:That included
pwdand the cleanup command, so the session could not evengit initthe repo it was meant to test against. The bug predates #108:StorePathsurfaced git's "not a git repository" as a generic store error, and gate hooks read any such error as "the store exists but cannot be read" and failed closed.Fix
gitutil.RunGitContexttells git's "not a git repository" answer apart from every other failure (gitutil.ErrNotARepository).db.StorePathmaps it toErrNoStore: outside a repo there is no main repo to key a store to, so there is no store — the same answer as a repo without one.storeOpenExitthen takes its existing no-store path: hooks allow,fellowshipcommands report "no fellowship state in this repo".TestStoreOpen_OutsideAnyRepoAllowsHookscovers all six hooks and thestatuscommand from a plain temp directory.go test -race ./..., vet and gofmt are clean. Changelog updated in README and the site.🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation