Re: any "must-have" hooks to implement on svn server?
> There are files that should exist in each developer's environment called
>> dbsecret.php.inc and reality.php.inc, and I want to make sure no one tries
>> to check in a file named that. This was my attempt in pre-commit to fix it,
>> but it doesn't seem to work. Any ideas?
>> $SVNLOOK changed -t "$TXN" "$REPOS" | \
>> grep -E "dbsecret.php.inc|reality.php.inc" > /dev/null || exit 1
> You're telling the script to exit if the filename is NOT dbsecret.php.inc
> or reality.php.inc, when actually you want the script to exit if the
> filename IS dbsecret.php.inc or reality.php.inc. Change "||" to "&&" to fix
> But you should also escape the special characters in the filenames (in this
> case the periods) and anchor the search to the beginning and end of the
> string (so you don't match files whose names merely CONTAIN dbsecret.php.inc
> or reality.php.inc). And you will probably want to print message to the user
> explaining what went wrong.
> $SVNLOOK changed -t "$TXN" "$REPOS" | \
> grep -E "^....(.*/)?(dbsecret\.php\.inc|reality\.php\.inc)$" >
> if [ $? -eq 0 ]; then
> echo "You con't commit files named dbsecret.php.inc or
> reality.php.inc" 1>&2
> exit 1
> exit 0
Excellent, thanks so much for the help, this worked like a charm. Two quick
questions so I understand what's going on, why the "...." at the beginning
of the regex? Shouldn't (.*/) be enough? Second, what's $? map to?
Searching "$? bash" didn't help.
Received on 2008-07-20 07:43:16 CEST
This is an archived mail posted to the Subversion Users