Commit Graph

6 Commits

Author SHA1 Message Date
Alex d7c7ff3dad Fix pre-commit symlink
(cherry picked from commit fe2e5cbfa6)
2023-05-12 13:12:50 +00:00
Alex 987aec3fd6 Revert change in git pre-commit hook.
(cherry picked from commit 28fd5f75c8)
2023-05-12 12:51:07 +00:00
Alex c3ee1111f9 Fix double negative signs in mask/paste margin overrides.
(cherry picked from commit efbd360440)
2023-05-12 12:45:09 +00:00
John Beard a7270f8c1c Formatting: prefer a Git config variable to env var
The keeps all the formatting config together in the Git ecosystem
and keeps the config on a per-repo basis, unless the user explicitly
sets it --global.

Keep the old env var behaviour for now for backwards compatibility.
2019-03-29 15:06:48 +00:00
John Beard a69cdf1793 Formatting: exclude generated files from git formatting hook
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
2019-03-29 15:06:48 +00:00
John Beard 409e884ce6 Add git format commit hook
This adds a pre-commit hook to warn of any style errors.

Also adds a 'hook-chain' script to simplify future hooks.

Add dev-doc note about how to use the formatter.
2018-10-29 10:47:51 -04:00