fix: misleading error message when git is not installed - #190
Conversation
The checkGitRepo() function was catching all execSync failures uniformly. When git is not installed, the error has code ENOENT with empty stderr, producing the misleading 'Not a git repository' message. Added an ENOENT check so users see 'git is not installed or not found on PATH' instead. Non-git-directory errors still show the original stderr message from git rev-parse. Fixes #185
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (2)src/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/git/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
🪛 ast-grep (0.44.0)src/git/diff.ts[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec. (detect-child-process-typescript) 🔇 Additional comments (1)
📝 WalkthroughWalkthroughUpdated the ChangesError Handling Fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
The
checkGitRepo()function was catching all execSync failures uniformly. When git is not installed, the error hascode: 'ENOENT'with empty stderr, producing the misleading "Not a git repository" message instead of telling the user git is missing.Added an
ENOENTcheck so users see "git is not installed or not found on PATH" when git is missing. The existing fallback for non-git directories (stderr fromgit rev-parse --git-dir) is preserved.Fixes #185
Summary by CodeRabbit