On Jul 19, 2008, at 09:22, Waynn Lue wrote:
> 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 this.
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)$" > /dev/
null
if [ $? -eq 0 ]; then
echo "You con't commit files named dbsecret.php.inc or
reality.php.inc" 1>&2
exit 1
fi
exit 0
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-07-20 07:24:36 CEST