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

Make pre-commit hook script POSIX compliant #1246

Closed
adatzer opened this issue Oct 10, 2023 · 0 comments
Closed

Make pre-commit hook script POSIX compliant #1246

adatzer opened this issue Oct 10, 2023 · 0 comments
Assignees
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.

Comments

@adatzer
Copy link
Contributor

adatzer commented Oct 10, 2023

Describe the bug

The pre-commit hook script uses $> /dev/null which is not POSIX compliant since it really intends > /dev/null 2>&1.

To Reproduce

Run the script where the standard command interpreter for the system is for example dash (e.g. Ubuntu):

#!/bin/sh

if ! command -v echo &> /dev/null
then
   echo 'not found'
else
   echo 'found'
fi

Output is:

not found
echo

Expected behavior

The script works as intended in all posix compliant shells.

Additional context
This can be a blocker for contributors as they need to run git commands with --no-verify, which even then is not guaranteed to work e.g. for interactive rebase.

@adatzer adatzer added the type:defect Bugs or weaknesses. The issue has to contain steps to reproduce. label Oct 10, 2023
@adatzer adatzer self-assigned this Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Projects
None yet
Development

No branches or pull requests

1 participant