SUMMARY As just discussed in the Automation BoF: At KPhotoAlbum we already have some git commit hooks that we use: https://invent.kde.org/graphics/kphotoalbum/-/tree/master/dev It would be nice to be able to continue to have our own commit hooks, plus use KDEGitCommitHooks in parallel and have both sets of commit hooks run.
I have misremembered when I said one can't use a custom hook – in case one has a preexisting hook, the defined hooks are appended. Though AFAICS this would not work in case a hook from KDEGitCommitHooks is removed, because we would not remove it from the script. So having the file entirely generated and adding custom scripts through the CMake function is reasonable either way.
I wonder if we should target kf5 for this, because consumers should be able to use it in both for 5 and 6 based apps. If it were to only exist in KF6, it would not always be set, but rather depend on the used major version of Qt.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/366
Git commit 072f57dbb641caa793cbcf359091439fe0dccef4 by Alexander Lohnau. Committed on 19/07/2023 at 15:33. Pushed by alex into branch 'master'. KDEGitCommitHooks: Allow passing in of custom scripts In case of kphotoalbum, the maintainer wants the clang-format hook in addition to a set of custom hooks. While we currently append to the file in case it exists, it would still mean that custom hooks have to be installed/configured separately. Because developers can not specify custom hooks, we can just override the file which will make the entire generation process easier. Since this is a small behavior change, it is put in a version guard. FIXED-IN: 5.109 M +39 -29 kde-modules/KDEGitCommitHooks.cmake M +1 -1 kde-modules/kde-git-commit-hooks/pre-commit.in https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/072f57dbb641caa793cbcf359091439fe0dccef4
Git commit c8a17d979af91554cf8a0e31bc68ed9336f14f4f by Alexander Lohnau. Committed on 21/07/2023 at 17:26. Pushed by alex into branch 'kf5'. KDEGitCommitHooks: Allow passing in of custom scripts In case of kphotoalbum, the maintainer wants the clang-format hook in addition to a set of custom hooks. While we currently append to the file in case it exists, it would still mean that custom hooks have to be installed/configured separately. Because developers can not specify custom hooks, we can just override the file which will make the entire generation process easier. Since this is a small behavior change, it is put in a version guard. FIXED-IN: 5.109 (cherry picked from commit 072f57dbb641caa793cbcf359091439fe0dccef4) M +39 -29 kde-modules/KDEGitCommitHooks.cmake M +1 -1 kde-modules/kde-git-commit-hooks/pre-commit.in https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/c8a17d979af91554cf8a0e31bc68ed9336f14f4f