Skip to content

Commit

Permalink
build: Check ".git" is a directory before hook install
Browse files Browse the repository at this point in the history
Check that `.git` is actually a directory before attempting to install
git hooks.

Fixes clearcontainers#951.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Jan 24, 2018
1 parent af73dec commit c533374
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c533374

Please sign in to comment.