Skip to content

refactor: pre-push-hook.sh potential regression#7264

Open
d0wn3d wants to merge 1 commit intodashpay:developfrom
d0wn3d:patch-1
Open

refactor: pre-push-hook.sh potential regression#7264
d0wn3d wants to merge 1 commit intodashpay:developfrom
d0wn3d:patch-1

Conversation

@d0wn3d
Copy link
Copy Markdown

@d0wn3d d0wn3d commented Apr 2, 2026

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$5 correctly, 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=SC2034 to bypass false positive x not being used warning.

How Has This Been Tested?

Not tested.

Breaking Changes

None.

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@d0wn3d d0wn3d changed the title refactor: fix a potential regression refactor: pre-push-hook.sh potential regression Apr 2, 2026
@thepastaclaw
Copy link
Copy Markdown

thepastaclaw commented Apr 2, 2026

⏳ Review in progress (commit 3b99477)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Walkthrough

The 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: local_ref, local_oid, remote_ref, and remote_oid. The branch check now compares remote_ref to refs/heads/master. When verifying signed commits, the script passes local_oid to verify-commits.py and, on failure, reruns verify-commits.py with the same local_oid. A shellcheck suppression was added for the unused local_ref variable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: pre-push-hook.sh potential regression' clearly identifies the main change—fixing a regression in the pre-push hook script's input parsing—and is concise and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the bug (quoted $LINE causing empty $3/$4), the problem with the prior workaround (ShellCheck SC2086), and the solution (using read for proper field parsing).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants