mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-23 22:24:46 +08:00
chore: add pre-commit hook to reject *@bytedance.com author/committer email
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
.githooks/pre-commit
Executable file
29
.githooks/pre-commit
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/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
|
||||||
Reference in New Issue
Block a user