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

Jonathan M Davis jmdavisProg at gmx.com
Sun Aug 14 13:09:33 PDT 2011


On Sunday, August 14, 2011 22:58:37 Vladimir Panteleev wrote:
> On Sun, 14 Aug 2011 22:50:22 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > Brad's suggestion is the correct way to
> > do it, I believe.
> 
> The advantage of a .gitattributes file is that you can add it to the
> repository (like .gitignore). I don't think you can set up a pre-commit
> hook so that it's copied when the repository is cloned.

You can setup hooks on the server to reject any commits with tabs or trailing 
whitespace or whatnot, but I don't believe that they get copied when you clone 
the repository. However, whether .gitattributes really helps is debatable. It 
does color the diffs, but it won't stop commits, and if you use git-diff -w, 
then it doesn't help at all (which I always do, since I want to see what's 
actually changed, not what's indented differently).

So, we could add .gitattributes, and it would help, but it wouldn't solve the 
problem.

- Jonathan M Davis


More information about the Digitalmars-d mailing list