From c5333741303774b911a0dc81906943df0bbc0df3 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Wed, 24 Jan 2018 11:09:08 +0000 Subject: [PATCH] build: Check ".git" is a directory before hook install Check that `.git` is actually a directory before attempting to install git hooks. Fixes #951. Signed-off-by: James O. D. Hunt --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 597eec84..0db27839 100644 --- a/Makefile +++ b/Makefile @@ -296,13 +296,13 @@ QUIET_GENERATE = $(Q:@=@echo ' GENERATE '$@;) QUIET_INST = $(Q:@=@echo ' INSTALL '$@;) QUIET_TEST = $(Q:@=@echo ' TEST '$@;) -# return non-empty string if file exists -define FILE_EXISTS -$(realpath $1) +# Return non-empty string if specified directory exists +define DIR_EXISTS +$(shell test -d $(1) && echo "$(1)") endef -# only install git hooks if working in a git clone -ifneq (,$(call FILE_EXISTS,.git)) +# Only install git hooks if working in a git clone +ifneq (,$(call DIR_EXISTS,.git)) HANDLE_GIT_HOOKS = install-git-hooks endif