Commit fdb2a77
fix(git-hooks): canonical polish from org-wide review
Three related fixes across pre-push and commit-msg, uncovered by
gemini/coderabbit review on crates#47, crates#48, dev#4, npm#31:
- pre-push: guard the force-push loop with [ -n "$PUSH_REFS" ] and skip
iterations with empty local_sha. Previous here-doc refactor fed a
trailing newline through the loop, causing `git merge-base` to fire
with empty args and falsely reject pushes without ref input.
- commit-msg: move the WIP/fixup/squash guard *before* the format check
so a user on main gets the branch-specific "WIP not allowed on main"
message instead of the generic "Invalid format" error. Previously dead
code because WIP messages never matched the Conventional Commits regex.
- commit-msg: tighten the ticket-prefix regex from [A-Z]+ to [A-Z]{2,}
for consistency with prepare-commit-msg, which only prepends 2+ char
prefixes. Also mention the Conventional Commits ! marker in the error
hint so users know `feat!:` is accepted.
Propagates to crates templates + npm via the open PRs rebasing or
re-syncing from this baseline.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 21c7a77 commit fdb2a77
2 files changed
+31
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 16 | + | |
| 17 | + | |
26 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
30 | | - | |
| 25 | + | |
31 | 26 | | |
32 | 27 | | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | | - | |
37 | | - | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
0 commit comments