在Collabnet SVN的預提交腳本中使用以下代碼來限制要提交的特定文件擴展名,但它提交了所有文件。你能告訴我哪裏出錯了嗎?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