fix(desktop): disable git hooks during worktree creation#1384
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds bypass for Git hooks during worktree creation by injecting Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
When Husky/lefthook hooks restrict PATH (removing NVM/asdf/volta paths), hooks calling pnpm/npm/yarn fail with "command not found" during `git worktree add`, blocking worktree creation entirely. Add `-c core.hooksPath=/dev/null` to all `git worktree add` invocations to bypass hooks. Worktree creation is programmatic and new worktrees don't have dependencies installed, so post-checkout hooks would fail anyway. Fixes superset-sh#961 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aa20fcb to
41f5765
Compare
|
Ah dang, thanks for debugging and adding the fix @FelipeLahti! |
|
I have been using Superset for a monorepo that I have git hooks configured, that take care of a lot of config for me. With this MR the hook no longer runs, and the worktree is useless to me. If you could please reconsider this PR and revert this sledgehammer as soon as possible 🙏 @Kitenite PS: Added additional thoughts here #1432 |
…)" This reverts commit af44e27.
Summary
-c core.hooksPath=/dev/nullto allgit worktree addinvocations to prevent post-checkout hooks (Husky, lefthook, etc.) from blocking worktree creationpnpm/npm/yarnfail with "command not found", causinggit worktree addto return non-zero and blocking worktree creation entirelyFixes #961
Test plan
git.test.tscovering:createWorktreesucceeds despite failing post-checkout hookcreateWorktreeFromExistingBranchsucceeds despite failing post-checkout hookgit worktree addbut succeeds withcore.hooksPath=/dev/nullbun test apps/desktop/src/lib/trpc/routers/workspaces/utils/git.test.ts🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests