From 2ca918fd2fd8bf775f166a20a20884031c8f2785 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 20 Feb 2015 00:12:55 +0100 Subject: [PATCH] Now ensures the user has required binaries before trying to set git hook. --- scripts/init-git-post-commit | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/init-git-post-commit b/scripts/init-git-post-commit index a174581..8345dec 100755 --- a/scripts/init-git-post-commit +++ b/scripts/init-git-post-commit @@ -1,5 +1,13 @@ #!/bin/sh +check_command() { + command -v "$1" > /dev/null 2>&1 || { echo "git-stats hook script requires the \`${1}\` binary in order to run." >&2; exit 1; } +} + +check_command "perl" +check_command "printf" +check_command "git" + echo "Setting up git-stats hooks."; git_templates_dir=$(git config --global --get init.templatedir);