mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-03 06:12:14 +08:00
30 lines
730 B
Bash
Executable File
30 lines
730 B
Bash
Executable File
#!/bin/sh
|
|
# Reject commit if author or committer email is *@bytedance.com
|
|
|
|
config_email="$(git config user.email)"
|
|
author_email="${GIT_AUTHOR_EMAIL:-$config_email}"
|
|
committer_email="${GIT_COMMITTER_EMAIL:-$config_email}"
|
|
|
|
check() {
|
|
case "$1" in
|
|
*@bytedance.com) return 0;; # matched = bad
|
|
*) return 1;;
|
|
esac
|
|
}
|
|
|
|
err=0
|
|
if check "$author_email"; then
|
|
echo "pre-commit: 拒绝提交:作者邮箱不能为 *@bytedance.com (当前: $author_email)"
|
|
err=1
|
|
fi
|
|
if check "$committer_email"; then
|
|
echo "pre-commit: 拒绝提交:提交者邮箱不能为 *@bytedance.com (当前: $committer_email)"
|
|
err=1
|
|
fi
|
|
|
|
if [ $err -eq 1 ]; then
|
|
echo "请使用: git config user.email \"lofisuchat@gmail.com\""
|
|
exit 1
|
|
fi
|
|
exit 0
|