Whitespace and bullying
martin at meltin.net
Sun Apr 8 22:22:43 UTC 2018
On Mon, 9 Apr 2018 09:13:01 +1200, Douglas Bagnall
<douglas.bagnall at catalyst.net.nz> wrote:
> On 07/04/18 20:59, Martin Schwenke via samba-technical wrote:
> > On Sat, 7 Apr 2018 18:32:02 +1000, ronnie sahlberg
> > <ronniesahlberg at gmail.com> wrote:
> >> We are talking about this expression for a git hook, right? "^\+.*[ \t]$"
> (actually the first 5 characters are redundant).
> > No, we only want to do this for C files... possibly others. Tests
> > might need to match spaces at the end of lines in program output, so if
> > a shell script is a test then you don't want to enable this check for it.
> I think this might work:
> git diff-index --check --cached HEAD -- :/*.[ch]
> it cares only about *new* whitespace errors in C files, and it prints a little
> colourised diff thing to show what it disliked.
OK, easier than I thought. Always nice when we don't have to write our
own code. ;-)
My suggestion would be that people use it in a pre-push hook to start
with. I already have a pre-push hook that checks for a Reviewed-by:
tag in every commit (happy to share again). Adding more checks is easy.
peace & happiness,
More information about the samba-technical