diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-12-26 15:46:13 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-12-26 15:46:13 -0800 |
commit | ba86d27dca584db96378936a4d54c87c7b0bbfba (patch) | |
tree | b9d07a5b8d4fd53e2594aed25947df979447b347 /.private | |
parent | 1bd541e45dc5f03d45ba9a15b1bc04872f831805 (diff) | |
download | libusb-ba86d27dca584db96378936a4d54c87c7b0bbfba.tar.gz |
Misc: Fix pre-commit hook to not emit errors in non-Bash shells
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to '.private')
-rwxr-xr-x | .private/pre-commit.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/.private/pre-commit.sh b/.private/pre-commit.sh index c495e33..346d48a 100755 --- a/.private/pre-commit.sh +++ b/.private/pre-commit.sh @@ -26,7 +26,13 @@ BRANCH_OFFSET=10000 ################################################################################ -type -P git &>/dev/null || { echo "git command not found. Aborting." >&2; exit 1; } +if [ "$BASH_VERSION" = '' ]; then + TYPE_CMD="type git >/dev/null 2>&1" +else + TYPE_CMD="type -P git &>/dev/null" +fi + +eval $TYPE_CMD || { echo "git command not found. Aborting." >&2; exit 1; } NANO=`git log --oneline | wc -l` NANO=`expr $NANO + $BRANCH_OFFSET` |