From 7fe4a9c96cfd7b3df458d08ca1e98cb56767f651 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Wed, 20 Jan 2021 13:06:46 +0100 Subject: [KDEGitCommitHooks] Create copy of scripts in source dir It was reported that in case of containerized setups where the source and build are in different containers the pre-commit script would reference a file which is another container and is consequently not found. To avoid this the script is copied in the source dir and a relative path is defined. --- kde-modules/KDEGitCommitHooks.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kde-modules/KDEGitCommitHooks.cmake b/kde-modules/KDEGitCommitHooks.cmake index 02c8f60f..7bbd024c 100644 --- a/kde-modules/KDEGitCommitHooks.cmake +++ b/kde-modules/KDEGitCommitHooks.cmake @@ -62,7 +62,8 @@ function(KDE_CONFIGURE_GIT_PRE_COMMIT_HOOK) if(KDE_CLANG_FORMAT_EXECUTABLE) list(FIND ARG_CHECKS "CLANG_FORMAT" _index) if (${_index} GREATER -1) - set(CLANG_FORMAT_SCRIPT ${CLANG_FORMAT_UNIX}) + set(CLANG_FORMAT_SCRIPT "./.git/hooks/scripts/clang-format.sh") + configure_file(${CLANG_FORMAT_UNIX} "${GIT_DIR}/hooks/scripts/clang-format.sh" @ONLY) endif() else() message(WARNING "No clang-format executable was found, skipping the formatting pre-commit hook") -- cgit v1.2.1