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

Why not just enforce auto-props with a hook script that sets the right properties

From: Peter Kahn <citizenkahn_at_gmail.com>
Date: Tue, 10 Jun 2008 15:46:05 -0400

Is there a reason why I shouldn't take check-mime-type.pl a step further and
have my hook script set properties on newly added files according to a
repository wide policy?

 I haven't seen anyone do this and I'm wondering what the reasons might be.
Most scripts seem to reject the commit instead of warning the user with a
nag-email and then performing the property settings automatically.
- files are added less often than they are modified
- forcing all users to modify their config to enable auto-props or set
defaults is difficult when there are 80+ users one many different
- All generic source files get eol-style set to native (cpp, java)
- All win specific source files get eol-style set to CRLF (.bat)
- All unix specific source files get eol-style set to LF (.sh)
- All binary files get needs-lock set to true (.jar)

The hook script would scan in the incoming commits. If the commit had text
files without eol-style set or binary files without needs-lock set, the the
script would:
- checkout the files
- update the properties
- commit the change with a useful comment "builder:r#### properties set

*Problems with this Approach:*
- it shields the users from two issues they should understand (newline and
- if there are exceptions how should the script clean up
- if there is a conflict how should the script deal with that (in theory the
hook used should prevent this)

It seems to make sense but..... Rejecting a commit with a meaningful
message is probably better. It is better to guide and train proper behavior
than making things too "easy". I could answer the other *problems* but I
think I just convinced myself that I need to teach a user to commit properly
with a rejection script (teach a man to fish vs. give a man a fish and all

Peter Kahn
Awareness - Intention - Action
Received on 2008-06-10 21:46:31 CEST

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.