I see, that’s good to know. I’ll definitely set it up, it does make sense to 
strip whitespace. Not sure why that isn’t done by default. :)

Now I just have to figure out if a dump/load will apply the hooks to to clean 
up old log messages that have trailing whitespace. Not a big deal in the scheme 
of things though.

On Apr 22, 2014, at 6:40 PM, Ryan Schmidt <subversion-2...@ryandesign.com> 
wrote:

> 
> On Apr 22, 2014, at 12:52, Justin Mrkva wrote:
> 
>> On Apr 21, 2014, at 6:19 PM, Ryan Schmidt wrote:
>> 
>>> Yes: install the log-police.py hook script in your repository.
>>> 
>>> http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/log-police.py
>> 
>> That looks good at first, but this excerpt from the Subversion book explains 
>> why that’s a bad idea:
>> 
>> While hook scripts can do almost anything, there is one dimension in which 
>> hook script authors should show restraint: do not modify a commit 
>> transaction using hook scripts. While it might be tempting to use hook 
>> scripts to automatically correct errors, shortcomings, or policy violations 
>> present in the files being committed, doing so can cause problems. 
>> Subversion keeps client-side caches of certain bits of repository data, and 
>> if you change a commit transaction in this way, those caches become 
>> indetectably stale. This inconsistency can lead to surprising and unexpected 
>> behavior. Instead of modifying the transaction, you should simply validate 
>> the transaction in the pre-commit hook and reject the commit if it does not 
>> meet the desired requirements.
>> 
>> I could of course just reject the commit if it has whitespace, but then that 
>> means that any commit using the command line editor would be rejected, 
>> because svn always adds the whitespace.
> 
> That passage of the book is referring to the content of the revision — the 
> diff of the files you committed; indeed you should not modify that in a hook 
> script, and I don’t know of any way, using the Subversion provided tools, to 
> do so. It does not refer to metadata of the revision — revision properties — 
> which are what this hook script modifies and which are safe to modify.
> 
> You’ll notice that this hook script is provided in Subversion’s own 
> repository. The developers of Subversion would not publish a script that 
> damages repositories.
> 
> The MacPorts project has been using this hook script for six years in their 
> repository. It works fine. I recommend you use it.
> 
> https://trac.macports.org/ticket/15069
> 
> 

Reply via email to