Is there anybody who has clear instructions on how to add a pre-commit hook that avoids changes to tags subdirectories?
I already searched the internet quite a bit.
Most of the previously written scripts are incomplete because several cases are not covered. This is my script:
contains_tags_dir=`$SVNLOOK changed --copy-info -t "$TXN" "$REPOS" | head -1 | egrep "+\/tags\/.*$" | wc -l | sed "s/ //g"`
if [ $contains_tags_dir -gt 0 ]
then
tags_dir_creation=`$SVNLOOK changed --copy-info -t "$TXN" "$REPOS" | head -1 | egrep "^A .+\/tags\/$" | wc -l | sed "s/ //g"`
if [ $tags_dir_creation -ne 1 ]
then
initial_add=`$SVNLOOK changed --copy-info -t "$TXN" "$REPOS" | head -1 | egrep "^A \+ .+\/tags\/.+\/$" | wc -l | sed "s/ //g"`
if [ $initial_add -ne 1 ]
then
echo "Tags cannot be changed!" 1>&2
exit 1
fi
fi
fi
It might seem complicated but you have to make sure that you are in /tags
and you are allowed create /tags
if it does not exist and all subsequent folders. Any other change is blocked. Almost none of the previous scripts cover all cases described in the Subversion book for svnlook changed ...
.