From 0c2f59c2a3bbeb2a361050e3600cacb995baa5e4 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 28 Jun 2016 10:27:06 +0200 Subject: [PATCH] Only install git hook if cloned from git. For source tarballs, the `.git/hooks` folder does not exist, so an error is shown when running `autogen.sh`. With this change, the hook is not installed in such cases. --- autogen.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autogen.sh b/autogen.sh index 3d90e9b7..ae6e6608 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,9 +1,11 @@ #!/bin/sh -# the pre-commit hook performs various formatting checks -if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \); then \ - rm -f .git/hooks/pre-commit; \ - ln -s ../../src/hooks/pre-commit.hook .git/hooks/pre-commit; \ +if [ -d ".git/hooks" ]; then + # the pre-commit hook performs various formatting checks + if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \); then \ + rm -f .git/hooks/pre-commit; \ + ln -s ../../src/hooks/pre-commit.hook .git/hooks/pre-commit; \ + fi fi if [ -x "`which autoreconf 2>/dev/null`" ] ; then