next.js
5c88a383 - Use posix-compatible syntax for pre-push hook (#68421)

Commit
1 year ago
Use posix-compatible syntax for pre-push hook (#68421) ### What? Use POSIX-compatible shell script syntax for the Husky `pre-push` hook. POSIX shell sadly doesn't support arrays, so fall back to using IFS-based string splitting (which is fine here). ### Why? - Husky ignores the shebang, and simply invokes `sh`: https://github.com/typicode/husky/issues/971 - On Debian-based distributions, [`sh` is provided by `dash`](https://wiki.archlinux.org/title/Dash), which is POSIX compatible, but does not support `bash`-specific features. - The Husky documentation has a workaround for using bash, but doesn't recommend it: https://typicode.github.io/husky/how-to.html#bash I do most of my development on a Debian VM, which is how I noticed this. ### Test Plan On Debian with `dash`, manually invoke it like so: ``` echo local_branch_name from_commit refs/heads/canary to_commit | sh -x .husky/pre-push canary git@github.com:vercel/next.js.git ```
Author
bgw bgw
Parents
Loading