git gurus: Any way to set it up to auto-warn contributors about tab indents?

Vladimir Panteleev vladimir at thecybershadow.net
Sun Aug 14 11:46:08 PDT 2011


On Sun, 14 Aug 2011 21:36:28 +0300, Nick Sabalausky <a at a.a> wrote:

> I don't know if this has already been looked into, but to any git/github
> gurus here: Is there some way to set up the "D-Programming-Language"
> projects (either in git or in github) so that users get warned when they
> have tab indents and try to commit, push, or pull-request (any one of  
> those
> three, wouldn't need to be all three of them)?

Yes. You can create a .gitattributes file with the following line:

*.d	whitespace=blank-at-eol,space-before-tab,tab-in-indent

This will color tabs used for indentation and trailing whitespace as red  
in diffs (and git gui).

More information:

http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_checking_whitespace_errors

http://www.kernel.org/pub/software/scm/git/docs/git-config.html - scroll  
down to core.whitespace

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list