Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Subversion server pre-commit hook for Unity3D .meta file. 约束 Assets 目录下添加、删除、移动、改名文件或目录时,必须要携带对应 .meta 文件。 如果提交的 log 中包含"The Shawshank Redemption",可以逃避此规则。
MAGICWORD='The Shawshank Redemption'
# Magic Word: The Shawshank Redemption.
# via
if $SVNLOOK log -t "$TXN" "$REPOS" | grep "$MAGICWORD" >/dev/null; then exit 0; fi
echo "!!! - lack .meta file" >&2
echo "!!! + lack original file" >&2
echo "!!! if log contain \"$MAGICWORD\", you can escape the rule." >&2
diff -u <($SVNLOOK changed -t "$TXN" "$REPOS" | grep "[AD] .*Assets/..*" | grep -v "\.meta$" | sed "s/\/$//" | sort) <($SVNLOOK changed -t "$TXN" "$REPOS" | grep "[AD] .*Assets/.*\.meta$" | sed "s/\.meta$//" | sort) >&2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment