fix(husky): quote branch comparison to handle detached HEAD - #69708
Merged
Conversation
rnegron
marked this pull request as ready for review
July 9, 2026 17:51
Contributor
|
Reviews (1): Last reviewed commit: "fix(husky): quote branch comparison to h..." | Re-trigger Greptile |
Contributor
There was a problem hiding this comment.
Trivial one-line quoting fix in a git hook script, no risky territory, verified behavior preserved.
- 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 2L, 1F substantive — within ceiling |
| tier | ✓ | T1-agent / T1a-trivial (2L, 1F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ c5c378d · reviewed head b501e5e |
rnegron
enabled auto-merge (squash)
July 9, 2026 17:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The pre-push hook compares branch names unquoted:
On a detached HEAD,
git branch --show-currentreturns an empty string, so the test expands to[ master = ]andshaborts with[: master: unary operator expectedon every push from a detached-HEAD worktree.Surfaced via
hogli devex:feedback(reported twice).Changes
Quote both operands so an empty
current_branchis compared as a string, not dropped:How did you test this code?
ci:preflightpassed.sh: [: master: unary operator expectedneqmastervsmasterstill returnseq, so pushing to master is still blocked (behavior preserved)..husky/*.Automatic notifications
Docs update
None.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Raúl surfaced this while triaging
hogli devex:feedbackentries for low-hanging fixes.I (Claude) confirmed the root cause at
.husky/pre-push:7, applied the quoting fix, and verified before/after behavior plus the preserved master-block in a scratch shell.No repo skills were needed beyond the CI-failure triage that found it.