From e1186bf37fb87ba412ac884d7e0283db90031d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 7 Mar 2023 09:03:19 +0100 Subject: [PATCH] Install git pre-commit hook only if there's a directory to put it in Closes: https://github.com/Eyescale/CMake/issues/603 --- GitHooks.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHooks.cmake b/GitHooks.cmake index ce447ed..068e389 100644 --- a/GitHooks.cmake +++ b/GitHooks.cmake @@ -11,7 +11,7 @@ endif() # Installing clang-format precommit hook if prerequisites are met and it doesn't # exist yet. -if(GIT_FOUND AND CLANG_FORMAT AND EXISTS ${PROJECT_SOURCE_DIR}/.git AND +if(GIT_FOUND AND CLANG_FORMAT AND EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/ AND NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit) # We cannot write the file from here because we need exec permissions