Repository navigation
Buffer hook stdin in a temporary file - #22698
Conversation
Co-authored-by: Copilot <[email protected]> Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
Co-authored-by: Copilot <[email protected]> Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
Co-authored-by: Copilot <[email protected]> Copilot-Session: 59aa81f0-bad9-4b81-9d8c-640d2a105880
There was a problem hiding this comment.
Pull request overview
This PR fixes Git hook stdin handling on Windows by buffering the hook proxy’s stdin into a temporary file and passing that file to git hook run --to-stdin=<path> (instead of /dev/stdin, which Git for Windows can’t open). It also threads the temporary hooks directory into the proxy so the buffered stdin file is cleaned up with the existing temp hooks dir lifecycle.
Changes:
- Pass
tmpHooksDirintocreateHooksProxyso the proxy can create per-invocation temp artifacts. - Replace
--to-stdin=/dev/stdinwith a unique temp file path and buffer the proxy stdin into that file before spawninggit hook run. - Improve cancellation behavior by aborting buffering when the proxy connection closes, and report buffering failures via hook progress.
Show a summary per file
| File | Description |
|---|---|
| app/src/lib/hooks/with-hooks-env.ts | Passes the per-operation temporary hooks directory into the hooks proxy and continues to clean it up in finally. |
| app/src/lib/hooks/hooks-proxy.ts | Buffers hook stdin into a unique temp file under tmpHooksDir and passes that path to git hook run --to-stdin. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
sergiou87
left a comment
There was a problem hiding this comment.
Is it possible to have an only-Windows test for this change? It'd be nice!
Possible certainly and that's what I started doing but I could not see a good enough reason to have to maintain platform specific logic here. I think the benefit of being able to test just on one platform with reasonable confidence outweighs the risk here. |
Closes #22620
Description
git hook run.--to-stdininstead of/dev/stdin, which is unavailable to Git for Windows.Screenshots
N/A - this change does not affect the UI.
Release notes
Notes: Fixed pre-push hooks failing on Windows when reading from stdin.