Misc: Fix pre-commit hook to not emit errors in non-Bash shells
authorChris Dickens <christopher.a.dickens@gmail.com>
Tue, 26 Dec 2017 23:46:13 +0000 (15:46 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Tue, 26 Dec 2017 23:46:13 +0000 (15:46 -0800)
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
.private/pre-commit.sh
libusb/version_nano.h

index c495e33..346d48a 100755 (executable)
 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`
index a6ee2d5..d978e75 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11224
+#define LIBUSB_NANO 11225