From 785009056890bb28cb5bf7accc0f102f39653210 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Wed, 6 Nov 2019 16:08:49 -0500
Subject: [PATCH] gitattributes: use clang-format for all source files

Also ignore some files which should not be formatted.
---
 .gitattributes                          | 26 ++++++++++++++++++-------
 Common/Core/.gitattributes              |  1 +
 Domains/Chemistry/.gitattributes        |  1 +
 Filters/Core/.gitattributes             |  2 ++
 IO/Import/.gitattributes                |  2 ++
 Rendering/Core/.gitattributes           |  1 +
 Rendering/FreeType/fonts/.gitattributes |  1 +
 Rendering/RayTracing/.gitattributes     |  1 +
 Wrapping/Tools/.gitattributes           |  3 +++
 9 files changed, 31 insertions(+), 7 deletions(-)
 create mode 100644 Domains/Chemistry/.gitattributes
 create mode 100644 Filters/Core/.gitattributes
 create mode 100644 IO/Import/.gitattributes
 create mode 100644 Rendering/Core/.gitattributes
 create mode 100644 Rendering/FreeType/fonts/.gitattributes
 create mode 100644 Rendering/RayTracing/.gitattributes
 create mode 100644 Wrapping/Tools/.gitattributes

diff --git a/.gitattributes b/.gitattributes
index 2be4c6e42e4..aedfb99ccf2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6,14 +6,26 @@ newalpha         crlf=input
 newversion       crlf=input
 pre-commit       crlf=input
 
-*.c              whitespace=tab-in-indent
-*.h              whitespace=tab-in-indent
-*.cxx            whitespace=tab-in-indent
-*.hxx            whitespace=tab-in-indent
-*.txx            whitespace=tab-in-indent
-*.txt            whitespace=tab-in-indent
-*.cmake          whitespace=tab-in-indent
+# Custom attribute to mark sources as using our C code style.
+[attr]our-c-style  whitespace=tab-in-indent,-blank-at-eol  format.clang-format=8
+
+*.c              our-c-style
+*.h              our-c-style
+*.cpp            our-c-style
+*.cxx            our-c-style
+*.hxx            our-c-style
+*.txx            our-c-style
+*.mm             our-c-style
+*.glsl           whitespace=tab-in-indent,-blank-at-eol
+*.txt            whitespace=tab-in-indent,-blank-at-eol
+*.cmake          whitespace=tab-in-indent,-blank-at-eol
 
 *.sha512         eol=lf
 
 *.md             whitespace=tab-in-indent conflict-marker-size=30
+
+# Third party code.
+Utilities/KWIML/**  -format.clang-format
+Utilities/KWSys/**  -format.clang-format
+Utilities/MetaIO/** -format.clang-format
+ThirdParty/**       -format.clang-format
diff --git a/Common/Core/.gitattributes b/Common/Core/.gitattributes
index 64686201023..2843053fb24 100644
--- a/Common/Core/.gitattributes
+++ b/Common/Core/.gitattributes
@@ -1 +1,2 @@
+vtkMersenneTwister_Private.cxx            -format.clang-format
 vtkWin32OutputWindowProcessEncodedData.c  -format.clang-format
diff --git a/Domains/Chemistry/.gitattributes b/Domains/Chemistry/.gitattributes
new file mode 100644
index 00000000000..f133b9cd0a9
--- /dev/null
+++ b/Domains/Chemistry/.gitattributes
@@ -0,0 +1 @@
+vtkBlueObeliskDataInternal.h  -format.clang-format
diff --git a/Filters/Core/.gitattributes b/Filters/Core/.gitattributes
new file mode 100644
index 00000000000..81b265100c9
--- /dev/null
+++ b/Filters/Core/.gitattributes
@@ -0,0 +1,2 @@
+# Generated by vtkStreamingTessellatorGenerator.py
+vtkStreamingTessellator.cxx  -format.clang-format
diff --git a/IO/Import/.gitattributes b/IO/Import/.gitattributes
new file mode 100644
index 00000000000..16fa57e1128
--- /dev/null
+++ b/IO/Import/.gitattributes
@@ -0,0 +1,2 @@
+mtlsyntax.*             -format.clang-format
+vtkVRMLImporter_Yacc.h  -format.clang-format
diff --git a/Rendering/Core/.gitattributes b/Rendering/Core/.gitattributes
new file mode 100644
index 00000000000..d3e9590b0b3
--- /dev/null
+++ b/Rendering/Core/.gitattributes
@@ -0,0 +1 @@
+vtkPythagoreanQuadruples.h  -format.clang-format
diff --git a/Rendering/FreeType/fonts/.gitattributes b/Rendering/FreeType/fonts/.gitattributes
new file mode 100644
index 00000000000..4b1289fb3fb
--- /dev/null
+++ b/Rendering/FreeType/fonts/.gitattributes
@@ -0,0 +1 @@
+face_*  -format.clang-format
diff --git a/Rendering/RayTracing/.gitattributes b/Rendering/RayTracing/.gitattributes
new file mode 100644
index 00000000000..eaa2ae23d07
--- /dev/null
+++ b/Rendering/RayTracing/.gitattributes
@@ -0,0 +1 @@
+RTWrapper/**    -format.clang-format
diff --git a/Wrapping/Tools/.gitattributes b/Wrapping/Tools/.gitattributes
new file mode 100644
index 00000000000..bcb99d00db2
--- /dev/null
+++ b/Wrapping/Tools/.gitattributes
@@ -0,0 +1,3 @@
+# Cached generated code.
+lex.yy.c        -format.clang-format
+vtkParse.tab.c  -format.clang-format
-- 
GitLab