fix(dev): make native git hooks work on Windows#2013
Conversation
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
Greptile SummaryThis PR updates the native git hooks to work better on Windows.
Confidence Score: 4/5The Windows staged-file formatting path needs a fix before merging.
tasks/smart-format.mts Important Files Changed
Reviews (1): Last reviewed commit: "fix(dev): run hook build before lint" | Re-trigger Greptile |
| @@ -61,5 +61,9 @@ if (existingFiles.length > 0) { | |||
| } | |||
|
|
|||
| function quoteAll(files: string[]): string { | |||
There was a problem hiding this comment.
When a staged Windows file path contains a space, this joins it into the shell command without quoting. A path like web/src/My Component.tsx is split into separate arguments, so the pre-commit formatter can fail or format the wrong targets instead of formatting the staged file.
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 7s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 11s | View ↗ |
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 4s | View ↗ |
nx run-many -t build |
✅ Succeeded | 5s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-27 13:08:55 UTC
|
@BittuBarnwal7479 Can you please explain more about your Windows setup? Are you using WSL or GitForWindows (MSysGit)? Thanks for helping fix these Windows issues! 🙏 |
i am not using wsl for this testing, i am using native windows.
in inside the repo i use: $env:Path = "D:\cedar\.yarn\shims;$env:Path"
yarn --version |
|
Can you try using Git Bash instead of PowerShell please? See if that helps |
Sure, I'll try it in Git Bash instead of PowerShell, I need a little more time. I'm just wrapping up another cool project using n8n. 🙂 |
|
No rush at all :) |
tested with Git Bash as well. it correctly handles the single-quoted Prettier glob, but I still hit With this branch, both hooks ran successfully: So I think the Windows-specific hook handling is still useful for native Windows users. |

Summary
Fixes a few Windows issues in the new native git hooks.
The hooks now:
distfilesTesting
Tested on Windows:
node tasks/git-hooks/pre-commit.mtsnode tasks/git-hooks/pre-push.mtsgit push origin HEADAll hooks passed.