diff options
author | The Assassin <theassassin@assassinate-you.net> | 2022-02-04 09:14:28 +0000 |
---|---|---|
committer | The Assassin <theassassin@assassinate-you.net> | 2022-02-04 09:14:28 +0000 |
commit | 927eb53580377f9460b8fc10cf3c561a31bde689 (patch) | |
tree | eac38c26f74de54d75312c469a6f09f966da2244 | |
parent | 48313bf31d92cfff175452101c787705e08c6560 (diff) | |
download | extra-cmake-modules-927eb53580377f9460b8fc10cf3c561a31bde689.tar.gz extra-cmake-modules-927eb53580377f9460b8fc10cf3c561a31bde689.tar.bz2 |
Make clang-format Git hook work in worktrees
Otherwise, commits will be rejected because the hook cannot be found from the workdir root dir (there is only one .git directory in a checkout, but commands are run relative to the worktree root dir).
-rw-r--r-- | kde-modules/KDEGitCommitHooks.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kde-modules/KDEGitCommitHooks.cmake b/kde-modules/KDEGitCommitHooks.cmake index c00c4c5f..b4819396 100644 --- a/kde-modules/KDEGitCommitHooks.cmake +++ b/kde-modules/KDEGitCommitHooks.cmake @@ -63,7 +63,7 @@ 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 "./.git/hooks/scripts/clang-format.sh") + set(CLANG_FORMAT_SCRIPT "\"$(git rev-parse --git-common-dir)\"/hooks/scripts/clang-format.sh") configure_file(${CLANG_FORMAT_UNIX} "${GIT_DIR}/hooks/scripts/clang-format.sh" @ONLY) endif() else() |