aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2021-01-20 13:06:46 +0100
committerChristoph Cullmann <cullmann@kde.org>2021-01-30 14:46:18 +0000
commit7fe4a9c96cfd7b3df458d08ca1e98cb56767f651 (patch)
treed5d1a255250bf29d472b44db2a8e2c33e7c2ae69
parenta50e45b8986f01f6b6c85f68d59a4491610ce29c (diff)
downloadextra-cmake-modules-7fe4a9c96cfd7b3df458d08ca1e98cb56767f651.tar.gz
extra-cmake-modules-7fe4a9c96cfd7b3df458d08ca1e98cb56767f651.tar.bz2
[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.
-rw-r--r--kde-modules/KDEGitCommitHooks.cmake3
1 files changed, 2 insertions, 1 deletions
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")