Add a .gitattributes files to provide a place to store file
attributes. Add a custom attribute for files that should be under
KiCad style guidelines.
Exclude generated files from the style enforcement. So far:
* bitmap .cpp files
* wxFormBuilder base classes
* Lemon grammars
It's now trivial to add the 'generated' attribute to any such
file.
Putting this into .gitattributes also means it can be retreived
programmatically, by other scripts, git alaises or on the command
line.
Use the attributes to provide a utility script to show or apply
formatting to controlled files (plain git clang-format won't
pick up our custom git attributes). Add details for the script in
the dev docs.
Also modiify the check-format hook to follow the .gitattributes
and only apply to cached (staged for commit) changes. Then you
won't be stopped committing because of bad formatting in unstaged
changed, or uncontrolled files.
Concept and some aspects of the implementation inspired by
CMake commit d5f39a56 [1].
[1]: d5f39a56a4
tool