Daniel Stenberg <[email protected]> writes:

> On Thu, 29 Oct 2009, Mononen Jussi wrote:
>
>> What about adding a git commit-hook that would run a code formatter?
>> Everyone could use their own style and the repo would still contain
>> a uniform style.
>
> I'm not a fan of that approach.
>
> * Indent rules are often overrideen when it makes sense for specific pieces of
>   code.
>
> * Automatic indenters sometimes have bugs.

Indent supports /* *INDENT-OFF* */ and /* *INDENT-ON* */ markers to
enable/disable indentation for a piece of code to mitigate these two
problems.

> * It's annoying to have code look different in your editor than what ends up
>   in the source code repo, as I then have to reformat it on every checkout
>   update as well and then how do I do diffs etc?

I haven't used an automatic commit-hook indenter before, but one
alternative that I have used is a commit-hook that refuses to commit
code that isn't properly indented.

Perhaps creating a make rule so that 'make indent' will indent all the
code easily, then it becomes easier to run this from time to time and
also easy for contributors to format their changes properly.

/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to