diff options
author | Brad King <brad.king@kitware.com> | 2023-01-17 19:23:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-18 16:48:49 (GMT) |
commit | 48639aa8fc3f63ecf01341acc4ac5d6ca7070364 (patch) | |
tree | 2dfe131a092cec9ac8231e65f8ac4db1383493a0 /Utilities | |
parent | 9ce1c870374dc1ab910ed921f41d03df75f254f3 (diff) | |
download | CMake-48639aa8fc3f63ecf01341acc4ac5d6ca7070364.zip CMake-48639aa8fc3f63ecf01341acc4ac5d6ca7070364.tar.gz CMake-48639aa8fc3f63ecf01341acc4ac5d6ca7070364.tar.bz2 |
clang-format.bash: Use generic clang-format attribute
Specify the clang-format version in the attribute value instead of its
name.
Issue: #24315
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/.gitattributes | 6 | ||||
-rwxr-xr-x | Utilities/Scripts/clang-format.bash | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes index 81bbf26..f799e88 100644 --- a/Utilities/.gitattributes +++ b/Utilities/.gitattributes @@ -3,6 +3,6 @@ SetupForDevelopment.sh export-ignore # Do not format third-party sources. -/KWIML/** -format.clang-format-6.0 -/cm*/** -format.clang-format-6.0 -/cmcurl/curltest.c format.clang-format-6.0 +/KWIML/** -format.clang-format +/cm*/** -format.clang-format +/cmcurl/curltest.c format.clang-format=6.0 diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash index 7ca4433..9b38a5b 100755 --- a/Utilities/Scripts/clang-format.bash +++ b/Utilities/Scripts/clang-format.bash @@ -40,7 +40,7 @@ Example to format files modified by the most recent commit: Utilities/Scripts/clang-format.bash --amend -Example to format all files: +Example to format all files tracked by Git: Utilities/Scripts/clang-format.bash --tracked @@ -115,10 +115,8 @@ esac $git_ls | # Select sources with our attribute. - git check-attr --stdin format.clang-format-6.0 | - grep -e ': format\.clang-format-6\.0: set$' | - sed -n 's/:[^:]*:[^:]*$//p' | + git check-attr --stdin format.clang-format | + sed -n '/: format\.clang-format: \(set\|6\.0\)$/ {s/:[^:]*:[^:]*$//p}' | # Update sources in-place. - tr '\n' '\0' | - xargs -0 "$clang_format" -i + xargs -d '\n' "$clang_format" -i |