[Insight-developers] uncrustify git hook

Brad King brad.king at kitware.com
Fri Sep 10 07:56:33 EDT 2010


On 09/09/2010 05:10 PM, Matthew McCormick (thewtex) wrote:
> I drafted a git pre-commit hook to run uncrustify and KWStyle checks on
> changes to the code.

I agree with Hans that it makes more sense to run this before releases.
People can rebase their unfinished topics on the release and update them
to the new style.  Running this on every commit can cause lots of extra
changes to a file and obscure the intended change.  We want to keep
commits as granular as possible.

A purely technical issue is that the "hooks" branch is actually a project
shared by a bunch of projects.  It should have no project-specific files.
Both uncrustify.conf and ITK.kws.xml.in should be in ITK's source tree.
We can point at them in the configuration:

 git config hooks.uncrustify.conf Utilities/.../uncrustify.conf
 git config hooks.KWStyle.conf Utilities/KWStyle/ITK.kws.xml.in

This can be simplified with a "Utilities/hooks.sh" setup script in the
ITK source tree (which can also set up the .git/hooks in the first place).

-Brad


More information about the Insight-developers mailing list