Discussions  >  CollabNet Subversion Admins  >  Re: SVN hook - post commit indent

Back to topic list

Re: SVN hook - post commit indent

Author cmpilato
Full name C. Michael Pilato
Date 2009-01-14 13:01:52 PST
Message Clearcase user wrote:
> Hi,
> I am new to SVN. I need to write a post-commit hook which runs indent for
> the file being committed prior to checking it in.

A post-commit hook is only triggered after the the commit is completed --
that is, after it has already been "checked in". Such a hook would have no
hope of modifying the file "being committed". The hooks which are triggered
*before* a commit is finalized are start-commit (which happens too early to
know what is being changed in the commit) and pre-commit (which happens
immediately after all the changes are sent to the server, and immediately
before those changes are finalized into the next revision of the repository.

Unfortunately, using pre-commit hook scripts to modify file contents is
strongly, strongly discouraged. Subversion's commit model is such that the
committing user's working copy would be left out of sync with what actually
made it into the commit. That out-of-syncness will result in checksum
errors and other complications upon further use of that working copy.

The recommended approach is to use pre-commit hooks to *check* the
formatting of incoming files, but merely return an error to the user if a
problem is found -- not to try to *fix* the problem.

C. Michael Pilato <XXXX@XXXX>
CollabNet <> www.collab.net <> Distributed Development On Demand

« Previous message in topic | 2 of 2 | Next message in topic »


Show all messages in topic

SVN hook - post commit indent cciug_user Clearcase user 2009-01-14 12:54:32 PST
     Re: SVN hook - post commit indent cmpilato C. Michael Pilato 2009-01-14 13:01:52 PST
Messages per page: