下面是我的预提交钩子代码,用于检查文本和打开的 trac 票证。文本检查工作,但是当分配恰好从 svnlook 获取文本并将其放入变量 $LOG 时,我收到一个错误,即找不到日志。我确定我只是精神错乱并且做了一些愚蠢的事情,但它在回避我为什么这不起作用。任何帮助,将不胜感激。
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
# Make sure that the log message contains some text.
$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null || exit 1
# Exit on all errors.
set -e
#ensure the commit is assciated to a TRAC ticket
TRAC_ENV="/trac"
LOG=$SVNLOOK log -t "$TXN" "$REPOS"
/usr/bin/python /trac/conf/trac-pre-commit-hook "$TRAC_ENV" "$LOG" || exit 1