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

Re: altering files with a pre-commit hook?

From: David Weintraub <qazwart_at_gmail.com>
Date: Mon, 22 Jun 2009 10:31:12 -0400

As others have stated: You don't do this because of the consequences.
In order to do this, you have to submit a SECOND commit which means
that the person who just did the commit will find their working
directory out of date.

Plus, there is the possibility of your second commit firing off
another pre-commit hook which might fire off another commit which
might fire off a third pre-commit hook all the way through all seven
circles of hell.

What I do is require the svn:eol-style property on certain file types
set to what is needed. For example, all *.sh, *.pl, Makefiles, and
other Unix files that require a <LF> line ending only, or for example,
all the special files that VisualStudio requires a <CR><LF> ending on.

The property will make sure that the file is stored with the correct
line ending in the repository, so your developers won't have to worry
about it. You can also let your developers know how to configure
autoproperties, so that when a new file is created, the correct
property is setup when the developer runs "svn add".

The autoproperties will keep your developers from getting frustrated
with the whole line ending issue.

On Sat, Jun 20, 2009 at 11:32 PM, Kenneth Riddile<kfriddile_at_yahoo.com> wrote:
> My team writes portable C/C++ that is all written with Visual Studio on
> Windows and is then used on both Windows and Unix.  GCC on Unix complains
> when files don't end in newlines while Visual Studio does not.  I already
> have a pre-commit hook that fails the commit when a source file doesn't end
> in a newline.  I was wondering if someone knows of a way to automatically
> append a newline to those files at pre-commit time instead of forcing the
> user to go and add them manually.  I won't be surprised if this can't be
> done since the ability to transparently modify files committed by the user
> could certainly be dangerous.
> Thanks,
> Kenny Riddile

David Weintraub
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-06-22 16:32:04 CEST

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