Created
December 16, 2011 02:12
-
-
Save hSATAC/1484109 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# place in {repo}/.git/hooks/update | |
# chmod +x update | |
name="$1" | |
old="$2" | |
new="$3" | |
user_name=$(git log -1 --pretty=format:%aN $new) | |
#branch=$(git rev-parse --symbolic --abbrev-ref $1) | |
branch=${name#refs/heads/} | |
if [ "$branch" == "master" ] || [ "$branch" == "staging" ] | |
then | |
if [ "$user_name" != "Kevin Luo" ] | |
then | |
echo "Username $user_name has no premission to commit branch [$branch]!" | |
exit 43 | |
else | |
exit 0 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
後來想到這個 script 邏輯錯誤了
他檢查的是 commit 的 author 而不是 pusher
在一般 git 環境似乎沒辦法抓到 pusher...