在 Collabnet SVN 的预提交脚本中使用以下代码来限制要提交的特定文件扩展名,但它正在提交所有文件。你能告诉我哪里出错了。
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/home/csvn/csvn/bin/svnlook
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 10 ];
then
echo -e "\n===========================================================" 1>&2
echo -e "|| COMMENTS ARE MADE MANDATORY.PLEASE ENTER RELEVANT COMMENT & COMMIT AGAIN Sanjeev sas||" 1>&2
echo -e "===========================================================" 1>&2
exit 1
fi
$SVNLOOK changed -t $TXN $REPOS | awk '
BEGIN {
FILTER=".(sh|xls|xlsx|pdf|jpg|JPG|gif|GIF|png|PNG|doc|DOC|docx|DOCX|mpg|swf|avi|mp3|mp4|zip|rar|gz|csv|o|obj|tar|gz|JPEG|jpeg|WMV|wmv|DAT|dat|3GP|3gp|MPEG|mpeg|VOD|vod|ear|jar|war|exe|ppt|PPT|PPTX|pptx|7z|iso|ISO|EAR|WAR|JAR|msg|MSG|rtf|RTF|xlsm|XLSM|vsd|VSD|dot|DOT|camrec|ECF|ecf|mff|MFF|class|CLASS)$"
}
{
for (i = 1; i < 2; i++) $i = ""; sub(/^ */, "");
if(match(tolower($1),FILTER))
{
print "File" $1 "is not allowed file type to commit"
exit 1
}
}'
exit 0