mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-08 22:37:04 +08:00
clang-format.bash: Use generic clang-format attribute
Specify the clang-format version in the attribute value instead of its name. Issue: #24315
This commit is contained in:
parent
9ce1c87037
commit
48639aa8fc
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -4,11 +4,11 @@
|
||||
.editorconfig export-ignore
|
||||
|
||||
# Custom attribute to mark sources as using our C code style.
|
||||
[attr]our-c-style whitespace=tab-in-indent format.clang-format-6.0
|
||||
[attr]our-c-style whitespace=tab-in-indent format.clang-format=6.0
|
||||
|
||||
# Custom attribute to mark sources as generated.
|
||||
# Do not perform whitespace checks. Do not format.
|
||||
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format-6.0
|
||||
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format
|
||||
|
||||
bootstrap eol=lf
|
||||
configure eol=lf
|
||||
|
2
Source/.gitattributes
vendored
2
Source/.gitattributes
vendored
@ -1,4 +1,4 @@
|
||||
CMakeVersion.cmake export-subst
|
||||
|
||||
# Do not format third-party sources.
|
||||
/kwsys/** -format.clang-format-6.0
|
||||
/kwsys/** -format.clang-format
|
||||
|
2
Source/CursesDialog/form/.gitattributes
vendored
2
Source/CursesDialog/form/.gitattributes
vendored
@ -1,2 +1,2 @@
|
||||
* -whitespace
|
||||
* -format.clang-format-6.0
|
||||
* -format.clang-format
|
||||
|
2
Tests/CSharpLinkFromCxx/.gitattributes
vendored
2
Tests/CSharpLinkFromCxx/.gitattributes
vendored
@ -1 +1 @@
|
||||
UsefulManagedCppClass.* -format.clang-format-6.0
|
||||
UsefulManagedCppClass.* -format.clang-format
|
||||
|
2
Tests/CompileFeatures/.gitattributes
vendored
2
Tests/CompileFeatures/.gitattributes
vendored
@ -1,2 +1,2 @@
|
||||
# Do not format a source containing C++11 '>>' syntax as C++98.
|
||||
cxx_right_angle_brackets.cpp -format.clang-format-6.0
|
||||
cxx_right_angle_brackets.cpp -format.clang-format
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Do not format a source where we want a long line preserved.
|
||||
pic_test.h -format.clang-format-6.0
|
||||
pic_test.h -format.clang-format
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Do not format a source encoded in UTF-16.
|
||||
test_UTF-16LE.h -format.clang-format-6.0
|
||||
test_UTF-16LE.h -format.clang-format
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Exclude reference content from formatting.
|
||||
* -format.clang-format-6.0
|
||||
* -format.clang-format
|
||||
|
@ -1 +1 @@
|
||||
Direct3DApp1.cpp -format.clang-format-6.0
|
||||
Direct3DApp1.cpp -format.clang-format
|
||||
|
6
Utilities/.gitattributes
vendored
6
Utilities/.gitattributes
vendored
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user