refactor: pre-push-hook.sh potential regression#7264
refactor: pre-push-hook.sh potential regression#7264d0wn3d wants to merge 1 commit intodashpay:developfrom
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
|
⏳ Review in progress (commit 3b99477) |
WalkthroughThe pre-push hook's stdin parsing was changed from reading a single unstructured line and using positional parameters to reading four tab-delimited fields into named variables: Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
With set -- A "$LINE" (quoted), the entire input line becomes $2 as a single string, leaving $3 and $4 empty. Since empty $4 never equals "refs/heads/master", the hook always continues, and the commit-signing verification never executes in either repo. Using the unquoted form set -- A $LINE (no quotes), which relied on word-splitting to populate $2…$5 correctly, trips ShellCheck's SC2086 rule. The fix is both ShellCheck-compliant and functionally correct.
Issue being fixed or feature implemented
With set -- A "$LINE" (quoted), the entire input line becomes $2 as a single string, leaving $3 and $4 empty.
Since empty $4 never equals "refs/heads/master", the hook always continues, and the commit-signing verification never executes in either repo.
Using the unquoted form
set -- A $LINE(no quotes), which relied on word-splitting to populate$2…$5correctly, trips ShellCheck's SC2086 rule.What was done?
Parse the fields directly with
read:The fix is both ShellCheck-compliant and functionally correct.
edit: Added
# shellcheck disable=SC2034to bypass false positivex not being usedwarning.How Has This Been Tested?
Not tested.
Breaking Changes
None.
Checklist:
Go over all the following points, and put an
xin all the boxes that apply.