[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Formating C/C++ code before commit with indent

From: Ulrich Eckhardt <eckhardt_at_satorlaser.com>
Date: 2005-06-21 15:44:44 CEST

Russ Brown wrote:
> Servico Tpd Rodrigo Alfonso Menezes Madera wrote:
> > All of our C/C++ projects follow a well defined format (wich can be
> > represented via indent params) and we wish to run indent just before the
> > commits. This is important because our programmers very different setting
> > in their editors such as tab spaces and formatting styles. The indent
> > program handles this ok. It just has to be executed before the commit.
[...]
> You could run the committed files against the formatter in the
> pre-commit hook, and if they don't match the original file the user
> didn't run the file through before committing, and you can reject the
> commit. That would force the users to run the files through the
> formatter first, though it wouldn't do it automatically.

Just for your info, there is no sane way to modify the data that was
committed. The reason is that if you modified the data that a user committed,
the user's local data would be out of sync with the data on the server,
leading to all kinds of trouble. Yes, there are possible solutions, but these
are rather complicated and not in Subversion.

That is the reason why you can only reject malformatted data, but not format
it yourself.

cheers

Uli

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Jun 21 15:45:23 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.