原因很简单:“github中的wp插件”工具并没有任何删除资产的功能。所以在git repo中没有截图-1。png,但在svn repo中——确实如此。
请参见:https://github.com/sudar/wp-plugin-in-github/blob/e5a004052342cbdfc5bd7fbcb844fffce8695f91/deploy-plugin.sh#L231
解决方法:
find $SVNPATH_ASSETS -type f -not -path \'*.svn*\' -delete
cp $GITPATH/$ASSETS_DIR/* $SVNPATH_ASSETS # copy assets */
cd $SVNPATH_ASSETS # Switch to assets directory
svn status | grep "^!" > /dev/null 2>&1 # Check if deleted assests exists
if [ $? -eq 0 ]; then
svn status | grep "^!" | awk \'{print $2}\' | xargs svn delete # Remove new assets
fi
svn status | grep "^?\\|^M" > /dev/null 2>&1 # Check if new or updated assets exists
if [ $? -eq 0 ]; then
svn status | grep "^?" | awk \'{print $2}\' | xargs svn add # Add new assets
fi
svn propset svn:mime-type image/jpeg *.jpg
svn propset svn:mime-type image/png *.png
svn status | egrep "^ ?(A|M|D)" > /dev/null 2>&1 # Check if we have somethign staged
if [ $? -eq 0 ]; then
svn commit --username=$SVNUSER -m "Updated assets"
echo "[Info] Assets committed to SVN."
else
echo "[Info] Contents of Assets directory unchanged. Ignoring it."
fi
# Let\'s remove the assets directory in /tmp which is not needed any more
rm -rf $SVNPATH_ASSETS