From aa42ba1ac81a105be0a405a0401094a96d99003d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 20 Feb 2025 09:03:42 -0500 Subject: [PATCH 1/2] gitattributes: Do not export pre-commit config file in source archives Exclude the file added by commit de59765336 (pre-commit: Add an initial configuration file, 2025-01-04, v4.0.0-rc1~118^2~11). --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 8151ec8b95..0e7ab060a3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ .clang-tidy export-ignore .codespellrc export-ignore .editorconfig export-ignore +.pre-commit-config.yaml export-ignore .typos.toml export-ignore # Custom attribute to mark sources as using our C code style. From 57a24181ed43446d963e9d093e58297916300b1c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 20 Feb 2025 09:07:03 -0500 Subject: [PATCH 2/2] clang-tidy: Do not require config file if not running clang-tidy Since commit 00cfea965b (gitattributes: Do not export lint config files in source archives, 2025-01-24, v4.0.0-rc1~129^2) the `.clang-tidy` config file is not available in source archives. Require it only when the `CMake_RUN_CLANG_TIDY` option is turned on, which we only do in development and CI builds. Fixes: #26712 --- CMakeLists.txt | 2 +- Utilities/CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1a12cb100..749404d0a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,8 +325,8 @@ if(CMake_RUN_CLANG_TIDY) unset(clang_tidy_module_sha1) endif() + configure_file(.clang-tidy .clang-tidy COPYONLY) endif() -configure_file(.clang-tidy .clang-tidy COPYONLY) option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 5e6ef0a361..e377733c5f 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -17,5 +17,7 @@ if(CMake_BUILD_WIX_CUSTOM_ACTION) add_subdirectory(Release/WiX) endif() -# Make sure generated files use the same clang-tidy checks (none). -configure_file(.clang-tidy .clang-tidy COPYONLY) +if(CMake_RUN_CLANG_TIDY) + # Make sure generated files use the same clang-tidy checks (none). + configure_file(.clang-tidy .clang-tidy COPYONLY) +endif()