[MLton] Tabs in source files

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Tue, 23 Aug 2005 17:54:05 +0300


Quoting Stephen Weeks <sweeks@sweeks.com>:
> > > a) reject a commit with tabs or b) fix a commit with tabs.
> ...
> > I would probably go with option b + notification of some sort.
> 
> My preference is option "a". I've made an attempt at implementing
> this via an svn "pre-commit" hook script.

Ok. I guessed you had already looked at the SVN hooks when you
implemented commit emails.

> I don't think option b is possible with svn, since
> hook scripts are not allowed to modify the transaction.

That seems to be the case. SVN doesn't send the committed files back
from the server after the commit succeeds. However, with some effort,
it would be possible to automate the cleaning up of sources. One way
to do it would be to use a post commit hook to start a sequence of
actions that
1. checks out the sources that need cleaning up,
2. cleans up the sources,
3. performs a second commit.
This technique has the drawback of not updating the original committer's
working files and requiring two commits. I mainly mention this scheme as
a (theoretical) possibility in case someone strongly objects to the
rejection of "dirty whitespace" commits. I don't think of this as a good
option. It would be better to do the clean up on the client side.

I personally use psvn.el (http://www.xsteve.at/prg/vc_svn/) in Emacs to
interact with SVN repositories. If there is interest, I could look into
contributing support for pre-commit checks/actions to psvn.el. It should
be possible to make the check & clean up in Emacs quite convenient.

> The tab pre-commit check only runs on the file suffixes I mentioned
> earlier.  Unsuffixed files are not checked.

I doubt unsuffixed files are common enough to cause much trouble.

> Suggestions on the best way to do this are appreciated.  We could use
> an svn property, either to indicate that tabs should be allowed, or
> that they should not.  Or we could simply ignore the issue for unsuffixed
> files.

I think that it is best to not modify unrecognized files.

-Vesa Karvonen