Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show run failure message when using a specific exit code #17

Closed
binsee opened this issue Apr 10, 2022 · 0 comments · Fixed by #18
Closed

Don't show run failure message when using a specific exit code #17

binsee opened this issue Apr 10, 2022 · 0 comments · Fixed by #18

Comments

@binsee
Copy link
Contributor

binsee commented Apr 10, 2022

Link to Chatie/git-scripts#18 (comment)

The git push hook is designed to determine if push is allowed. If the hook returns non-zero, a red error message is bound to be displayed.

The push hook scripts we use need to run npm version, add a commit record, and execute a git push inside the hook, so it needs to prevent external git push, so it returns non-zero.

But when hook script returns non-zero, bin/hooks/pre-push will report an error, showing Failed to exec pre-push hook script.

If the hook actually ran successfully, we shouldn't show this prompt, so a specific exit code should be defined to identify this situation.

  • use 42 as a specific exit code
  • After the hook runs successfully, with 42 as the exit code
  • When the exit code is 42 found in bin/hooks/*, do not display an error message and exit to git with a non-zero value.
binsee added a commit to binsee/git-scripts that referenced this issue Apr 10, 2022
Don't show run failure message when using a specific exit code
Fixes zixia#17
@huan huan closed this as completed in #18 Apr 12, 2022
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 a pull request may close this issue.

1 participant