Skip to content

Commit 2ca918f

Browse files
committed
Now ensures the user has required binaries before trying to set git hook.
1 parent 3800e24 commit 2ca918f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/init-git-post-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/sh
22

3+
check_command() {
4+
command -v "$1" > /dev/null 2>&1 || { echo "git-stats hook script requires the \`${1}\` binary in order to run." >&2; exit 1; }
5+
}
6+
7+
check_command "perl"
8+
check_command "printf"
9+
check_command "git"
10+
311
echo "Setting up git-stats hooks.";
412

513
git_templates_dir=$(git config --global --get init.templatedir);

0 commit comments

Comments
 (0)