diff --git a/.gitattributes b/.gitattributes index 71ecacf2a6..43ad3b7efc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/Source/.gitattributes b/Source/.gitattributes index d0aedc2001..4b868dda54 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -1,4 +1,4 @@ CMakeVersion.cmake export-subst # Do not format third-party sources. -/kwsys/** -format.clang-format-6.0 +/kwsys/** -format.clang-format diff --git a/Source/CursesDialog/form/.gitattributes b/Source/CursesDialog/form/.gitattributes index 6dfa6277f3..6e255e4165 100644 --- a/Source/CursesDialog/form/.gitattributes +++ b/Source/CursesDialog/form/.gitattributes @@ -1,2 +1,2 @@ * -whitespace -* -format.clang-format-6.0 +* -format.clang-format diff --git a/Tests/CSharpLinkFromCxx/.gitattributes b/Tests/CSharpLinkFromCxx/.gitattributes index cf9d35537c..57a39049e0 100644 --- a/Tests/CSharpLinkFromCxx/.gitattributes +++ b/Tests/CSharpLinkFromCxx/.gitattributes @@ -1 +1 @@ -UsefulManagedCppClass.* -format.clang-format-6.0 +UsefulManagedCppClass.* -format.clang-format diff --git a/Tests/CompileFeatures/.gitattributes b/Tests/CompileFeatures/.gitattributes index 95a89568ae..83da28dac3 100644 --- a/Tests/CompileFeatures/.gitattributes +++ b/Tests/CompileFeatures/.gitattributes @@ -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 diff --git a/Tests/PositionIndependentTargets/.gitattributes b/Tests/PositionIndependentTargets/.gitattributes index 61b2751cb9..ed36631f45 100644 --- a/Tests/PositionIndependentTargets/.gitattributes +++ b/Tests/PositionIndependentTargets/.gitattributes @@ -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 diff --git a/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes index d9a4db4099..9c22288cd8 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes +++ b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes @@ -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 diff --git a/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes index d9b566e130..883a7f16da 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes +++ b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes @@ -1,2 +1,2 @@ # Exclude reference content from formatting. -* -format.clang-format-6.0 +* -format.clang-format diff --git a/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes b/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes index 78a54694d9..601c97b7b8 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes +++ b/Tests/VSWinStorePhone/Direct3DApp1/.gitattributes @@ -1 +1 @@ -Direct3DApp1.cpp -format.clang-format-6.0 +Direct3DApp1.cpp -format.clang-format diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes index 81bbf2679c..f799e88369 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 7ca4433a81..9b38a5b6c8 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