The problem with these kind of commit-time checks is that you only find
out the problem *after* you've validated your nicely polished commits.
This is easily solved by adding this line to .emacs file:
(add-hook 'before-save-hook 'delete-trailing-whitespace)
No more trailing whitespaces.
The problem with this approach is that if a file already contains
trailing whitespace, you'll introduce spurious changes in your commit.
I wouldn't call it a problem, but a feature - provided that you put whitespace
changes in a separate commit. In this way we would gradually get rid of all
There's some justification for -fwarn-tabs: tabs can lead to confusing
failures when people use the wrong tab setting in their editor. On the
other hand, I don't think there's any good reason for having the
compiler warn about trailing whitespace.
Cheers,
Simon
On 22/08/13 17:18,
On 20/08/13 12:21, Geoffrey Mainland wrote:
Would be nice to have. How about a third hook that disallows commits
that include whitespace-only changes unless *all* changes are
whitespace-only? ;)
The problem with these kind of commit-time checks is that you only find
out the problem *after*
This seems acceptable IMO. The general working conventions already are to
separate whitespace and/or tab changes from a commit containing actual
content. If you ./validate cleanly, but the server rejects the push for
whitespace, adding an extra commit on top to clean up the affected files
seems
GHC already has -fwarn-tabs; we could have -fwarn-trailing-whitespace
and turn it on by default, so that validate errors on it but you also
notice it when you're doing a build (if you're paying attention to
warnings).
Edward
Excerpts from Simon Marlow's message of Thu Aug 22 05:04:50 -0700 2013:
Right now we have a git hook that prevents pushing a file containing tabs,
unless that file had them already (in other words: no new files with tabs in
our repos). I propose to add similar hook for trailing whitespaces. Herbert
says he can implement that. What do others think? Would you find
Would be nice to have. How about a third hook that disallows commits
that include whitespace-only changes unless *all* changes are
whitespace-only? ;)
Geoff
On 08/20/2013 10:59 AM, Jan Stolarek wrote:
Right now we have a git hook that prevents pushing a file containing tabs,
unless that file
On 2013-08-20 at 13:21:02 +0200, Geoffrey Mainland wrote:
How about a third hook that disallows commits that include
whitespace-only changes unless *all* changes are whitespace-only? ;)
The other two validations were about preserving an invariant (file has
no tabs file has no trailing