Whitespace and bullying

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Sun Apr 8 21:13:01 UTC 2018

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.


More information about the samba-technical mailing list